fix(ivy): generate a type parameter for InjectorDef (#24738)

InjectorDef is parameterized on the type of the injector
configuration class (e.g. the @NgModule decorated type). Previously
this parameter was not included when generating .d.ts files that
contained InjectorDefs.

PR Close #24738
This commit is contained in:
Alex Rickabaugh 2018-06-29 14:03:18 -07:00 committed by Matias Niemelä
parent d05d28629d
commit a1b630ee8f
2 changed files with 8 additions and 1 deletions

View File

@ -107,7 +107,8 @@ export function compileInjector(meta: R3InjectorMetadata): R3InjectorDef {
providers: meta.providers, providers: meta.providers,
imports: meta.imports, imports: meta.imports,
})]); })]);
const type = new o.ExpressionType(o.importExpr(R3.InjectorDef)); const type =
new o.ExpressionType(o.importExpr(R3.InjectorDef, [new o.ExpressionType(meta.type)]));
return {expression, type}; return {expression, type};
} }

View File

@ -408,6 +408,12 @@ export declare abstract class Injector {
/** @experimental */ /** @experimental */
export declare const INJECTOR: InjectionToken<Injector>; export declare const INJECTOR: InjectionToken<Injector>;
export interface InjectorDef<T> {
factory: () => T;
imports: (InjectorType<any> | InjectorTypeWithProviders<any>)[];
providers: (Type<any> | ValueProvider | ExistingProvider | FactoryProvider | ConstructorProvider | StaticClassProvider | ClassProvider | any[])[];
}
/** @experimental */ /** @experimental */
export interface InjectorType<T> extends Type<T> { export interface InjectorType<T> extends Type<T> {
ngInjectorDef: never; ngInjectorDef: never;