fix(core): Deprecate TestBed.get(...):any (#29290)
Adds an overload to TestBed.get making parameters strongly typed and deprecated previous signature that accepted types `any`. The function still returns `any` to prevent build breakages, but eventually stronger type checks will be added so a future Angular version will break builds due to additional type checks. See previous breaking change - #13785 Issue #26491 PR Close #29290
This commit is contained in:
committed by
Igor Minar
parent
9c056b974a
commit
609024f93d
+10
-8
@@ -62,15 +62,16 @@ export interface TestBed {
|
||||
useValue?: any;
|
||||
deps?: any[];
|
||||
}): void;
|
||||
deprecatedOverrideProvider(token: any, provider: {
|
||||
useValue: any;
|
||||
}): void;
|
||||
/** @deprecated */ deprecatedOverrideProvider(token: any, provider: {
|
||||
useFactory: Function;
|
||||
deps: any[];
|
||||
}): void;
|
||||
deprecatedOverrideProvider(token: any, provider: {
|
||||
useValue: any;
|
||||
}): void;
|
||||
execute(tokens: any[], fn: Function, context?: any): any;
|
||||
get(token: any, notFoundValue?: any): any;
|
||||
get<T>(token: Type<T> | InjectionToken<T>, notFoundValue?: T, flags?: InjectFlags): any;
|
||||
/** @deprecated */ get(token: any, notFoundValue?: any): any;
|
||||
initTestEnvironment(ngModule: Type<any> | Type<any>[], platform: PlatformRef, aotSummaries?: () => any[]): void;
|
||||
overrideComponent(component: Type<any>, override: MetadataOverride<Component>): void;
|
||||
overrideDirective(directive: Type<any>, override: MetadataOverride<Directive>): void;
|
||||
@@ -82,11 +83,11 @@ export interface TestBed {
|
||||
deps?: any[];
|
||||
}): void;
|
||||
overrideProvider(token: any, provider: {
|
||||
useFactory: Function;
|
||||
deps: any[];
|
||||
useValue: any;
|
||||
}): void;
|
||||
overrideProvider(token: any, provider: {
|
||||
useValue: any;
|
||||
useFactory: Function;
|
||||
deps: any[];
|
||||
}): void;
|
||||
overrideTemplateUsingTestingModule(component: Type<any>, template: string): void;
|
||||
resetTestEnvironment(): void;
|
||||
@@ -116,7 +117,8 @@ export interface TestBedStatic {
|
||||
useFactory: Function;
|
||||
deps: any[];
|
||||
}): void;
|
||||
get(token: any, notFoundValue?: any): any;
|
||||
/** @deprecated */ get(token: any, notFoundValue?: any): any;
|
||||
get<T>(token: Type<T> | InjectionToken<T>, notFoundValue?: T, flags?: InjectFlags): any;
|
||||
initTestEnvironment(ngModule: Type<any> | Type<any>[], platform: PlatformRef, aotSummaries?: () => any[]): TestBed;
|
||||
overrideComponent(component: Type<any>, override: MetadataOverride<Component>): TestBedStatic;
|
||||
overrideDirective(directive: Type<any>, override: MetadataOverride<Directive>): TestBedStatic;
|
||||
|
||||
Reference in New Issue
Block a user