diff --git a/packages/injector/src/injector.ts b/packages/injector/src/injector.ts index bcf724267..bea096862 100644 --- a/packages/injector/src/injector.ts +++ b/packages/injector/src/injector.ts @@ -251,7 +251,7 @@ export class Injector implements InjectorInterface { throw new Error(`Invalid get argument given ${token}`); } - set(token: T, value: any, scope?: Scope): void { + set(token: ContainerToken, value: any, scope?: Scope): void { if (!this.setter) throw new Error('Injector was not built'); this.setter(token, value, scope); } @@ -915,7 +915,11 @@ export class InjectorContext { } set(token: T, value: any, module?: InjectorModule): void { - return this.getInjector(module || this.rootModule).set(token, value, this.scope); + return this.getInjector(module || this.rootModule).set( + getContainerToken(token), + value, + this.scope, + ); } static forProviders(providers: ProviderWithScope[]) {