From a1b630ee8ffca94cffea1c091122e692a19f87f6 Mon Sep 17 00:00:00 2001 From: Alex Rickabaugh Date: Fri, 29 Jun 2018 14:03:18 -0700 Subject: [PATCH] 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 --- packages/compiler/src/render3/r3_module_compiler.ts | 3 ++- tools/public_api_guard/core/core.d.ts | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/compiler/src/render3/r3_module_compiler.ts b/packages/compiler/src/render3/r3_module_compiler.ts index 8b83f25931..921bae7ecf 100644 --- a/packages/compiler/src/render3/r3_module_compiler.ts +++ b/packages/compiler/src/render3/r3_module_compiler.ts @@ -107,7 +107,8 @@ export function compileInjector(meta: R3InjectorMetadata): R3InjectorDef { providers: meta.providers, 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}; } diff --git a/tools/public_api_guard/core/core.d.ts b/tools/public_api_guard/core/core.d.ts index 04893d869f..09052c005c 100644 --- a/tools/public_api_guard/core/core.d.ts +++ b/tools/public_api_guard/core/core.d.ts @@ -408,6 +408,12 @@ export declare abstract class Injector { /** @experimental */ export declare const INJECTOR: InjectionToken; +export interface InjectorDef { + factory: () => T; + imports: (InjectorType | InjectorTypeWithProviders)[]; + providers: (Type | ValueProvider | ExistingProvider | FactoryProvider | ConstructorProvider | StaticClassProvider | ClassProvider | any[])[]; +} + /** @experimental */ export interface InjectorType extends Type { ngInjectorDef: never;