refactor(ivy): make return value of define(Component|Directive|Pipe|Injector|Injectable) private (#23371) (#23383)
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 opaque token. For this reson why declare the return value of `defineInjectable` as `never`. PR Close #23383
This commit is contained in:
@ -38,13 +38,13 @@ export const enum RenderFlags {
|
||||
* A subclass of `Type` which has a static `ngComponentDef`:`ComponentDef` field making it
|
||||
* consumable for rendering.
|
||||
*/
|
||||
export interface ComponentType<T> extends Type<T> { ngComponentDef: ComponentDef<T>; }
|
||||
export interface ComponentType<T> extends Type<T> { ngComponentDef: never; }
|
||||
|
||||
/**
|
||||
* A subclass of `Type` which has a static `ngDirectiveDef`:`DirectiveDef` field making it
|
||||
* consumable for rendering.
|
||||
*/
|
||||
export interface DirectiveType<T> extends Type<T> { ngDirectiveDef: DirectiveDef<T>; }
|
||||
export interface DirectiveType<T> extends Type<T> { ngDirectiveDef: never; }
|
||||
|
||||
export const enum DirectiveDefFlags {ContentQuery = 0b10}
|
||||
|
||||
@ -52,7 +52,7 @@ export const enum DirectiveDefFlags {ContentQuery = 0b10}
|
||||
* A subclass of `Type` which has a static `ngPipeDef`:`PipeDef` field making it
|
||||
* consumable for rendering.
|
||||
*/
|
||||
export interface PipeType<T> extends Type<T> { ngPipeDef: PipeDef<T>; }
|
||||
export interface PipeType<T> extends Type<T> { ngPipeDef: never; }
|
||||
|
||||
/**
|
||||
* Runtime link information for Directives.
|
||||
|
Reference in New Issue
Block a user