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:
Carlos Ortiz García 2019-08-29 13:54:49 -07:00 committed by Matias Niemelä
parent 5356826a38
commit a85eccd6ff
4 changed files with 20 additions and 20 deletions

View File

@ -162,11 +162,11 @@ export class TestBedRender3 implements TestBed {
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;
/** 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;
/** 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 = Injector.THROW_IF_NOT_FOUND,
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;
}
/** 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;
/** 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;
/** 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,
flags: InjectFlags = InjectFlags.Default): any {
return this.inject(token, notFoundValue, flags);

View File

@ -62,9 +62,9 @@ export interface TestBed {
token: Type<T>|InjectionToken<T>|AbstractType<T>, notFoundValue: null, flags?: InjectFlags): T
|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;
/** 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;
execute(tokens: any[], fn: Function, context?: any): any;
@ -226,14 +226,14 @@ export class TestBedViewEngine implements TestBed {
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;
/**
* TODO(goodwine): Mark as deprecated from v9.0.0 use TestBed.inject
* @deprecated from v9.0.0 use TestBed.inject
* @suppress {duplicate}
*/
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(
token: any, notFoundValue: any = Injector.THROW_IF_NOT_FOUND,
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;
}
/** 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;
/** 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;
/** 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,
flags: InjectFlags = InjectFlags.Default): any {
return this.inject(token, notFoundValue, flags);

View File

@ -120,9 +120,9 @@ export interface TestBedStatic {
token: Type<T>|InjectionToken<T>|AbstractType<T>, notFoundValue: null, flags?: InjectFlags): T
|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;
/** 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;
createComponent<T>(component: Type<T>): ComponentFixture<T>;

View File

@ -58,8 +58,8 @@ export interface TestBed {
configureTestingModule(moduleDef: TestModuleMetadata): void;
createComponent<T>(component: Type<T>): ComponentFixture<T>;
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;
/** @deprecated */ get<T>(token: Type<T> | InjectionToken<T>, notFoundValue?: T, flags?: InjectFlags): any;
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: null, flags?: InjectFlags): T | null;
@ -95,8 +95,8 @@ export interface TestBedStatic {
}): TestBedStatic;
configureTestingModule(moduleDef: TestModuleMetadata): TestBedStatic;
createComponent<T>(component: Type<T>): ComponentFixture<T>;
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;
/** @deprecated */ get<T>(token: Type<T> | InjectionToken<T>, notFoundValue?: T, flags?: InjectFlags): any;
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?: T, flags?: InjectFlags): T;