refactor(ivy): make return value of define(Component|Directive|Pipe|Injector|Injectable) private (#23371)
Ivy definition looks something like this: ``` class MyService { static ngInjectableDef = defineInjectable({ … }); } ``` Here the argument to `defineInjectable` is well known public contract which needs to be honored in backward compatible way between versions. The type of the return value of `defineInjectable` on the other hand is private and can change shape drastically between versions without effecting backwards compatibility of libraries publish to NPM. To our users it is effectively an `OpaqueToken`. By prefixing the type with `ɵ` we are communicating the the outside world that the value is not public API and is subject to change without backward compatibility. PR Close #23371
This commit is contained in:

committed by
Igor Minar

parent
f4017ce5e3
commit
2c09b707ce
@ -8,7 +8,8 @@
|
||||
|
||||
import {Type} from '../type';
|
||||
|
||||
import {InjectableDef, defineInjectable} from './defs';
|
||||
import {defineInjectable, ɵInjectableDef} from './defs';
|
||||
|
||||
|
||||
/**
|
||||
* Creates a token that can be used in a DI Provider.
|
||||
@ -52,7 +53,7 @@ export class InjectionToken<T> {
|
||||
/** @internal */
|
||||
readonly ngMetadataName = 'InjectionToken';
|
||||
|
||||
readonly ngInjectableDef: InjectableDef<T>|undefined;
|
||||
readonly ngInjectableDef: ɵInjectableDef<T>|undefined;
|
||||
|
||||
constructor(protected _desc: string, options?: {
|
||||
providedIn?: Type<any>| 'root' | null,
|
||||
@ -72,5 +73,5 @@ export class InjectionToken<T> {
|
||||
}
|
||||
|
||||
export interface InjectableDefToken<T> extends InjectionToken<T> {
|
||||
ngInjectableDef: InjectableDef<T>;
|
||||
ngInjectableDef: ɵInjectableDef<T>;
|
||||
}
|
||||
|
Reference in New Issue
Block a user