feat: tree-shakeable providers API updates (#22655)
Rename @Injectable({scope -> providedIn}). Instead of {providedIn: APP_ROOT_SCOPE}, accept {providedIn: 'root'}. Also, {providedIn: null} implies the injectable should not be added to any scope. PR Close #22655
This commit is contained in:

committed by
Kara Erickson

parent
21e44c6ba9
commit
db56836425
18
tools/public_api_guard/core/core.d.ts
vendored
18
tools/public_api_guard/core/core.d.ts
vendored
@ -112,9 +112,6 @@ export declare const APP_ID: InjectionToken<string>;
|
||||
/** @experimental */
|
||||
export declare const APP_INITIALIZER: InjectionToken<(() => void)[]>;
|
||||
|
||||
/** @experimental */
|
||||
export declare const APP_ROOT_SCOPE: Type<any>;
|
||||
|
||||
/** @experimental */
|
||||
export declare class ApplicationInitStatus {
|
||||
readonly done: boolean;
|
||||
@ -347,7 +344,10 @@ export declare class DefaultIterableDiffer<V> implements IterableDiffer<V>, Iter
|
||||
}
|
||||
|
||||
/** @experimental */
|
||||
export declare function defineInjectable(opts: Injectable): Injectable;
|
||||
export declare function defineInjectable<T>(opts: {
|
||||
providedIn?: Type<any> | 'root' | null;
|
||||
factory: () => T;
|
||||
}): InjectableDef<T>;
|
||||
|
||||
/** @experimental */
|
||||
export declare function destroyPlatform(): void;
|
||||
@ -461,11 +461,11 @@ export declare const Injectable: InjectableDecorator;
|
||||
export interface InjectableDecorator {
|
||||
/** @stable */ (): any;
|
||||
(options?: {
|
||||
scope: Type<any>;
|
||||
providedIn: Type<any> | 'root' | null;
|
||||
} & InjectableProvider): any;
|
||||
new (): Injectable;
|
||||
new (options?: {
|
||||
scope: Type<any>;
|
||||
providedIn: Type<any> | 'root' | null;
|
||||
} & InjectableProvider): Injectable;
|
||||
}
|
||||
|
||||
@ -474,7 +474,7 @@ export declare type InjectableProvider = ValueSansProvider | ExistingSansProvide
|
||||
|
||||
/** @experimental */
|
||||
export interface InjectableType<T> extends Type<T> {
|
||||
ngInjectableDef?: Injectable;
|
||||
ngInjectableDef: InjectableDef<T>;
|
||||
}
|
||||
|
||||
/** @stable */
|
||||
@ -493,9 +493,9 @@ export declare const enum InjectFlags {
|
||||
/** @stable */
|
||||
export declare class InjectionToken<T> {
|
||||
protected _desc: string;
|
||||
readonly ngInjectableDef: Injectable | undefined;
|
||||
readonly ngInjectableDef: InjectableDef<T> | undefined;
|
||||
constructor(_desc: string, options?: {
|
||||
scope: Type<any>;
|
||||
providedIn?: Type<any> | 'root' | null;
|
||||
factory: () => T;
|
||||
});
|
||||
toString(): string;
|
||||
|
Reference in New Issue
Block a user