feat(core): Deprecate TestBed.get as deprecated (#32406)
From 9.0.0 use TestBed.inject See #32200 Fixes #26491 PR Close #32406
This commit is contained in:
parent
5356826a38
commit
a85eccd6ff
|
@ -162,11 +162,11 @@ export class TestBedRender3 implements TestBed {
|
||||||
return _getTestBedRender3().inject(token, notFoundValue, flags);
|
return _getTestBedRender3().inject(token, notFoundValue, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** TODO(goodwine): Mark as deprecated from v9.0.0 use TestBed.inject */
|
/** @deprecated from v9.0.0 use TestBed.inject */
|
||||||
static get<T>(token: Type<T>|InjectionToken<T>, notFoundValue?: T, flags?: InjectFlags): any;
|
static get<T>(token: Type<T>|InjectionToken<T>, notFoundValue?: T, flags?: InjectFlags): any;
|
||||||
/** TODO(goodwine): Mark as deprecated from v9.0.0 use TestBed.inject */
|
/** @deprecated from v9.0.0 use TestBed.inject */
|
||||||
static get(token: any, notFoundValue?: any): any;
|
static get(token: any, notFoundValue?: any): any;
|
||||||
/** TODO(goodwine): Mark as deprecated from v9.0.0 use TestBed.inject */
|
/** @deprecated from v9.0.0 use TestBed.inject */
|
||||||
static get(
|
static get(
|
||||||
token: any, notFoundValue: any = Injector.THROW_IF_NOT_FOUND,
|
token: any, notFoundValue: any = Injector.THROW_IF_NOT_FOUND,
|
||||||
flags: InjectFlags = InjectFlags.Default): any {
|
flags: InjectFlags = InjectFlags.Default): any {
|
||||||
|
@ -271,11 +271,11 @@ export class TestBedRender3 implements TestBed {
|
||||||
return result === UNDEFINED ? this.compiler.injector.get(token, notFoundValue, flags) : result;
|
return result === UNDEFINED ? this.compiler.injector.get(token, notFoundValue, flags) : result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** TODO(goodwine): Mark as deprecated from v9.0.0 use TestBed.inject */
|
/** @deprecated from v9.0.0 use TestBed.inject */
|
||||||
get<T>(token: Type<T>|InjectionToken<T>, notFoundValue?: T, flags?: InjectFlags): any;
|
get<T>(token: Type<T>|InjectionToken<T>, notFoundValue?: T, flags?: InjectFlags): any;
|
||||||
/** TODO(goodwine): Mark as deprecated from v9.0.0 use TestBed.inject */
|
/** @deprecated from v9.0.0 use TestBed.inject */
|
||||||
get(token: any, notFoundValue?: any): any;
|
get(token: any, notFoundValue?: any): any;
|
||||||
/** TODO(goodwine): Mark as deprecated from v9.0.0 use TestBed.inject */
|
/** @deprecated from v9.0.0 use TestBed.inject */
|
||||||
get(token: any, notFoundValue: any = Injector.THROW_IF_NOT_FOUND,
|
get(token: any, notFoundValue: any = Injector.THROW_IF_NOT_FOUND,
|
||||||
flags: InjectFlags = InjectFlags.Default): any {
|
flags: InjectFlags = InjectFlags.Default): any {
|
||||||
return this.inject(token, notFoundValue, flags);
|
return this.inject(token, notFoundValue, flags);
|
||||||
|
|
|
@ -62,9 +62,9 @@ export interface TestBed {
|
||||||
token: Type<T>|InjectionToken<T>|AbstractType<T>, notFoundValue: null, flags?: InjectFlags): T
|
token: Type<T>|InjectionToken<T>|AbstractType<T>, notFoundValue: null, flags?: InjectFlags): T
|
||||||
|null;
|
|null;
|
||||||
|
|
||||||
/** TODO(goodwine): Mark as deprecated from v9.0.0 use TestBed.inject */
|
/** @deprecated from v9.0.0 use TestBed.inject */
|
||||||
get<T>(token: Type<T>|InjectionToken<T>, notFoundValue?: T, flags?: InjectFlags): any;
|
get<T>(token: Type<T>|InjectionToken<T>, notFoundValue?: T, flags?: InjectFlags): any;
|
||||||
/** TODO(goodwine): Mark as deprecated from v9.0.0 use TestBed.inject */
|
/** @deprecated from v9.0.0 use TestBed.inject */
|
||||||
get(token: any, notFoundValue?: any): any;
|
get(token: any, notFoundValue?: any): any;
|
||||||
|
|
||||||
execute(tokens: any[], fn: Function, context?: any): any;
|
execute(tokens: any[], fn: Function, context?: any): any;
|
||||||
|
@ -226,14 +226,14 @@ export class TestBedViewEngine implements TestBed {
|
||||||
return _getTestBedViewEngine().inject(token, notFoundValue, flags);
|
return _getTestBedViewEngine().inject(token, notFoundValue, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** TODO(goodwine): Mark as deprecated from v9.0.0 use TestBed.inject */
|
/** @deprecated from v9.0.0 use TestBed.inject */
|
||||||
static get<T>(token: Type<T>|InjectionToken<T>, notFoundValue?: T, flags?: InjectFlags): any;
|
static get<T>(token: Type<T>|InjectionToken<T>, notFoundValue?: T, flags?: InjectFlags): any;
|
||||||
/**
|
/**
|
||||||
* TODO(goodwine): Mark as deprecated from v9.0.0 use TestBed.inject
|
* @deprecated from v9.0.0 use TestBed.inject
|
||||||
* @suppress {duplicate}
|
* @suppress {duplicate}
|
||||||
*/
|
*/
|
||||||
static get(token: any, notFoundValue?: any): any;
|
static get(token: any, notFoundValue?: any): any;
|
||||||
/** TODO(goodwine): Mark as deprecated from v9.0.0 use TestBed.inject */
|
/** @deprecated from v9.0.0 use TestBed.inject */
|
||||||
static get(
|
static get(
|
||||||
token: any, notFoundValue: any = Injector.THROW_IF_NOT_FOUND,
|
token: any, notFoundValue: any = Injector.THROW_IF_NOT_FOUND,
|
||||||
flags: InjectFlags = InjectFlags.Default): any {
|
flags: InjectFlags = InjectFlags.Default): any {
|
||||||
|
@ -483,11 +483,11 @@ export class TestBedViewEngine implements TestBed {
|
||||||
return result === UNDEFINED ? this._compiler.injector.get(token, notFoundValue, flags) : result;
|
return result === UNDEFINED ? this._compiler.injector.get(token, notFoundValue, flags) : result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** TODO(goodwine): Mark as deprecated from v9.0.0 use TestBed.inject */
|
/** @deprecated from v9.0.0 use TestBed.inject */
|
||||||
get<T>(token: Type<T>|InjectionToken<T>, notFoundValue?: T, flags?: InjectFlags): any;
|
get<T>(token: Type<T>|InjectionToken<T>, notFoundValue?: T, flags?: InjectFlags): any;
|
||||||
/** TODO(goodwine): Mark as deprecated from v9.0.0 use TestBed.inject */
|
/** @deprecated from v9.0.0 use TestBed.inject */
|
||||||
get(token: any, notFoundValue?: any): any;
|
get(token: any, notFoundValue?: any): any;
|
||||||
/** TODO(goodwine): Mark as deprecated from v9.0.0 use TestBed.inject */
|
/** @deprecated from v9.0.0 use TestBed.inject */
|
||||||
get(token: any, notFoundValue: any = Injector.THROW_IF_NOT_FOUND,
|
get(token: any, notFoundValue: any = Injector.THROW_IF_NOT_FOUND,
|
||||||
flags: InjectFlags = InjectFlags.Default): any {
|
flags: InjectFlags = InjectFlags.Default): any {
|
||||||
return this.inject(token, notFoundValue, flags);
|
return this.inject(token, notFoundValue, flags);
|
||||||
|
|
|
@ -120,9 +120,9 @@ export interface TestBedStatic {
|
||||||
token: Type<T>|InjectionToken<T>|AbstractType<T>, notFoundValue: null, flags?: InjectFlags): T
|
token: Type<T>|InjectionToken<T>|AbstractType<T>, notFoundValue: null, flags?: InjectFlags): T
|
||||||
|null;
|
|null;
|
||||||
|
|
||||||
/** TODO(goodwine): Mark as deprecated from v9.0.0 use TestBed.inject */
|
/** @deprecated from v9.0.0 use TestBed.inject */
|
||||||
get<T>(token: Type<T>|InjectionToken<T>, notFoundValue?: T, flags?: InjectFlags): any;
|
get<T>(token: Type<T>|InjectionToken<T>, notFoundValue?: T, flags?: InjectFlags): any;
|
||||||
/** TODO(goodwine): Mark as deprecated from v9.0.0 use TestBed.inject */
|
/** @deprecated from v9.0.0 use TestBed.inject */
|
||||||
get(token: any, notFoundValue?: any): any;
|
get(token: any, notFoundValue?: any): any;
|
||||||
|
|
||||||
createComponent<T>(component: Type<T>): ComponentFixture<T>;
|
createComponent<T>(component: Type<T>): ComponentFixture<T>;
|
||||||
|
|
|
@ -58,8 +58,8 @@ export interface TestBed {
|
||||||
configureTestingModule(moduleDef: TestModuleMetadata): void;
|
configureTestingModule(moduleDef: TestModuleMetadata): void;
|
||||||
createComponent<T>(component: Type<T>): ComponentFixture<T>;
|
createComponent<T>(component: Type<T>): ComponentFixture<T>;
|
||||||
execute(tokens: any[], fn: Function, context?: any): any;
|
execute(tokens: any[], fn: Function, context?: any): any;
|
||||||
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;
|
/** @deprecated */ get<T>(token: Type<T> | InjectionToken<T>, notFoundValue?: T, flags?: InjectFlags): any;
|
||||||
initTestEnvironment(ngModule: Type<any> | Type<any>[], platform: PlatformRef, aotSummaries?: () => any[]): void;
|
initTestEnvironment(ngModule: Type<any> | Type<any>[], platform: PlatformRef, aotSummaries?: () => any[]): void;
|
||||||
inject<T>(token: Type<T> | InjectionToken<T> | AbstractType<T>, notFoundValue?: T, flags?: InjectFlags): T;
|
inject<T>(token: Type<T> | InjectionToken<T> | AbstractType<T>, notFoundValue?: T, flags?: InjectFlags): T;
|
||||||
inject<T>(token: Type<T> | InjectionToken<T> | AbstractType<T>, notFoundValue: null, flags?: InjectFlags): T | null;
|
inject<T>(token: Type<T> | InjectionToken<T> | AbstractType<T>, notFoundValue: null, flags?: InjectFlags): T | null;
|
||||||
|
@ -95,8 +95,8 @@ export interface TestBedStatic {
|
||||||
}): TestBedStatic;
|
}): TestBedStatic;
|
||||||
configureTestingModule(moduleDef: TestModuleMetadata): TestBedStatic;
|
configureTestingModule(moduleDef: TestModuleMetadata): TestBedStatic;
|
||||||
createComponent<T>(component: Type<T>): ComponentFixture<T>;
|
createComponent<T>(component: Type<T>): ComponentFixture<T>;
|
||||||
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;
|
/** @deprecated */ get<T>(token: Type<T> | InjectionToken<T>, notFoundValue?: T, flags?: InjectFlags): any;
|
||||||
initTestEnvironment(ngModule: Type<any> | Type<any>[], platform: PlatformRef, aotSummaries?: () => any[]): TestBed;
|
initTestEnvironment(ngModule: Type<any> | Type<any>[], platform: PlatformRef, aotSummaries?: () => any[]): TestBed;
|
||||||
inject<T>(token: Type<T> | InjectionToken<T> | AbstractType<T>, notFoundValue: null, flags?: InjectFlags): T | null;
|
inject<T>(token: Type<T> | InjectionToken<T> | AbstractType<T>, notFoundValue: null, flags?: InjectFlags): T | null;
|
||||||
inject<T>(token: Type<T> | InjectionToken<T> | AbstractType<T>, notFoundValue?: T, flags?: InjectFlags): T;
|
inject<T>(token: Type<T> | InjectionToken<T> | AbstractType<T>, notFoundValue?: T, flags?: InjectFlags): T;
|
||||||
|
|
Loading…
Reference in New Issue