Description
Compiling a typescript application with strict null checks enabled will produce a number of errors due to the definition of HookMatchCriteria:
ERROR in /home/schoel/Projekte/javascript/i3ge/node_modules/ui-router-core/lib/transition/interface.d.ts
(735,5): error TS2411: Property 'to' of type 'string | boolean | Predicate | undefined' is not assignable to string index type 'string | boolean | Predicate'.ERROR in /home/schoel/Projekte/javascript/i3ge/node_modules/ui-router-core/lib/transition/interface.d.ts
(737,5): error TS2411: Property 'from' of type 'string | boolean | Predicate | undefined' is not assignable to string index type 'string | boolean | Predicate'.ERROR in /home/schoel/Projekte/javascript/i3ge/node_modules/ui-router-core/lib/transition/interface.d.ts
(739,5): error TS2411: Property 'exiting' of type 'string | boolean | Predicate | undefined' is not assignable to string index type 'string | boolean | Predicate'.ERROR in /home/schoel/Projekte/javascript/i3ge/node_modules/ui-router-core/lib/transition/interface.d.ts
(741,5): error TS2411: Property 'retained' of type 'string | boolean | Predicate | undefined' is not assignable to string index type 'string | boolean | Predicate'.ERROR in /home/schoel/Projekte/javascript/i3ge/node_modules/ui-router-core/lib/transition/interface.d.ts
(743,5): error TS2411: Property 'entering' of type 'string | boolean | Predicate | undefined' is not assignable to string index type 'string | boolean | Predicate'.
This is because the type of the string keyed property ([key: string]: HookMatchCriterion
) has to match the type any other property in the interface. All other properties are optional, though, and thus of type HookMatchCriterion | undefined
. Changing the type of the string keyed property to HookMatchCriterion | undefined
resolves the issue.