From 4f6014a756a95ff9cb55e91deb27039b7eb079ee Mon Sep 17 00:00:00 2001 From: SkyZeroZx <73321943+SkyZeroZx@users.noreply.github.com> Date: Wed, 10 Dec 2025 18:08:55 -0500 Subject: [PATCH] fix(core): avoid false-positive deprecation when using `InjectionToken` with factory only Prevents the deprecation warning that was incorrectly triggered when defining an InjectionToken with only a `factory`, which correctly defaults to the `root` scope. --- goldens/public-api/core/index.api.md | 2 +- packages/core/src/di/injection_token.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/goldens/public-api/core/index.api.md b/goldens/public-api/core/index.api.md index 9d556fe1f78..33110bb93e9 100644 --- a/goldens/public-api/core/index.api.md +++ b/goldens/public-api/core/index.api.md @@ -922,7 +922,7 @@ export interface InjectDecorator { export class InjectionToken { // @deprecated constructor(_desc: string, options: { - providedIn?: Type | 'any'; + providedIn: Type | 'any'; factory: () => T; }); constructor(_desc: string, options?: { diff --git a/packages/core/src/di/injection_token.ts b/packages/core/src/di/injection_token.ts index 1f377c8092d..4d5990dddd1 100644 --- a/packages/core/src/di/injection_token.ts +++ b/packages/core/src/di/injection_token.ts @@ -74,7 +74,7 @@ export class InjectionToken { constructor( _desc: string, options: { - providedIn?: Type | 'any'; + providedIn: Type | 'any'; factory: () => T; }, );