feat(ivy): require 'token' for ngInjectableDef (#30855)

The compiler generates a 'token' field when it emits an ngInjectableDef,
but this field was not required by defineInjectable or the InjectableDef
interface, nor was it added by InjectionToken.

This commit makes 'token' required and adds it where missing.

PR Close #30855
This commit is contained in:
Alex Rickabaugh
2019-06-07 10:12:07 -07:00
committed by Andrew Kushnir
parent b0866769b0
commit a4b4f35533
16 changed files with 77 additions and 14 deletions

View File

@ -307,7 +307,7 @@ export function ɵɵdefineComponent<T>(componentDefinition: {
// be retrieved through the node injector, so this isn't a problem.
if (!type.hasOwnProperty(NG_INJECTABLE_DEF)) {
(type as any)[NG_INJECTABLE_DEF] =
ɵɵdefineInjectable<T>({factory: componentDefinition.factory as() => T});
ɵɵdefineInjectable<T>({token: type, factory: componentDefinition.factory as() => T});
}
}) as never;