mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
fix(core): fix typing on injector.get to omit 'any' (#60202)
This commit further restricts the deprecated type on injector.get to exclude all but `string`. Progresses towards #48408 BREAKING CHANGE: The `any` overload has been removed from `injector.get`. It now only supports `ProviderToken<T>` and (deprecated since v4) `string`. PR Close #60202
This commit is contained in:
committed by
Andrew Kushnir
parent
0cff9a12d3
commit
ff772d7800
@@ -695,7 +695,7 @@ export abstract class EnvironmentInjector implements Injector {
|
||||
// @deprecated
|
||||
abstract get<T>(token: ProviderToken<T>, notFoundValue?: T, flags?: InjectFlags): T;
|
||||
// @deprecated (undocumented)
|
||||
abstract get(token: any, notFoundValue?: any): any;
|
||||
abstract get<T>(token: string | ProviderToken<T>, notFoundValue?: any): any;
|
||||
// @deprecated
|
||||
abstract runInContext<ReturnT>(fn: () => ReturnT): ReturnT;
|
||||
}
|
||||
@@ -966,7 +966,7 @@ export abstract class Injector {
|
||||
// @deprecated
|
||||
abstract get<T>(token: ProviderToken<T>, notFoundValue?: T, flags?: InjectFlags): T;
|
||||
// @deprecated (undocumented)
|
||||
abstract get(token: any, notFoundValue?: any): any;
|
||||
abstract get<T>(token: string | ProviderToken<T>, notFoundValue?: any): any;
|
||||
// (undocumented)
|
||||
static NULL: Injector;
|
||||
// (undocumented)
|
||||
|
||||
@@ -94,7 +94,7 @@ export abstract class Injector {
|
||||
* @deprecated from v4.0.0 use ProviderToken<T>
|
||||
* @suppress {duplicate}
|
||||
*/
|
||||
abstract get(token: any, notFoundValue?: any): any;
|
||||
abstract get<T>(token: string | ProviderToken<T>, notFoundValue?: any): any;
|
||||
|
||||
/**
|
||||
* @deprecated from v5 use the new signature Injector.create(options)
|
||||
|
||||
@@ -163,7 +163,7 @@ export abstract class EnvironmentInjector implements Injector {
|
||||
* @deprecated from v4.0.0 use ProviderToken<T>
|
||||
* @suppress {duplicate}
|
||||
*/
|
||||
abstract get(token: any, notFoundValue?: any): any;
|
||||
abstract get<T>(token: string | ProviderToken<T>, notFoundValue?: any): any;
|
||||
|
||||
/**
|
||||
* Runs the given function in the context of this `EnvironmentInjector`.
|
||||
|
||||
Reference in New Issue
Block a user