refactor(ivy): undeprecate inject (#30132)

PR Close #30132
This commit is contained in:
Ben Lesh 2019-04-25 16:30:50 -07:00 committed by Andrew Kushnir
parent 71b8b355a6
commit b9f0720c95
2 changed files with 16 additions and 15 deletions

View File

@ -71,10 +71,23 @@ export function injectInjectorOnly<T>(
/**
* Generated instruction: Injects a token from the currently active injector.
*
* WARNING: This function is meant to be generated by the Ivy compiler, and is not meant for
* developer consumption!
* Must be used in the context of a factory function such as one defined for an
* `InjectionToken`. Throws an error if not called from such a context.
*
* https://github.com/angular/angular/blob/master/packages/core/src/render3/DELTA_INSTRUCTIONS.md
* (Additional documentation moved to `inject`, as it is the public API, and an alias for this instruction)
*
* @see inject
* @codeGenApi
*/
export function ɵɵinject<T>(token: Type<T>| InjectionToken<T>): T;
export function ɵɵinject<T>(token: Type<T>| InjectionToken<T>, flags?: InjectFlags): T|null;
export function ɵɵinject<T>(token: Type<T>| InjectionToken<T>, flags = InjectFlags.Default): T|
null {
return (_injectImplementation || injectInjectorOnly)(token, flags);
}
/**
* Injects a token from the currently active injector.
*
* Must be used in the context of a factory function such as one defined for an
* `InjectionToken`. Throws an error if not called from such a context.
@ -97,17 +110,6 @@ export function injectInjectorOnly<T>(
*
* @publicApi
*/
export function ɵɵinject<T>(token: Type<T>| InjectionToken<T>): T;
export function ɵɵinject<T>(token: Type<T>| InjectionToken<T>, flags?: InjectFlags): T|null;
export function ɵɵinject<T>(token: Type<T>| InjectionToken<T>, flags = InjectFlags.Default): T|
null {
return (_injectImplementation || injectInjectorOnly)(token, flags);
}
/**
* @deprecated in v8, delete after v10. This API should be used only be generated code, and that
* code should now use ɵɵinject instead.
* @publicApi
*/
export const inject = ɵɵinject;
/**

View File

@ -383,7 +383,6 @@ export interface HostListenerDecorator {
new (eventName: string, args?: string[]): any;
}
/** @deprecated */
export declare const inject: typeof ɵɵinject;
export interface Inject {