Skip to content

Commit 4f6014a

Browse files
SkyZeroZxalxhub
authored andcommitted
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.
1 parent 1636451 commit 4f6014a

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

goldens/public-api/core/index.api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -922,7 +922,7 @@ export interface InjectDecorator {
922922
export class InjectionToken<T> {
923923
// @deprecated
924924
constructor(_desc: string, options: {
925-
providedIn?: Type<any> | 'any';
925+
providedIn: Type<any> | 'any';
926926
factory: () => T;
927927
});
928928
constructor(_desc: string, options?: {

packages/core/src/di/injection_token.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export class InjectionToken<T> {
7474
constructor(
7575
_desc: string,
7676
options: {
77-
providedIn?: Type<any> | 'any';
77+
providedIn: Type<any> | 'any';
7878
factory: () => T;
7979
},
8080
);

0 commit comments

Comments
 (0)