fix(ivy): remove metadata from *Def and introduce *DefWithMeta types (#26203)
Previously in Ivy, metadata for directives/components/modules/etc was carried in .d.ts files inside type information encoded on the DirectiveDef, ComponentDef, NgModuleDef, etc types of Ivy definition fields. This works well, but has the side effect of complicating Ivy's runtime code as these extra generic type parameters had to be specified as <any> throughout the codebase. *DefInternal types were introduced previously to mitigate this issue, but that's the wrong way to solve the problem. This commit returns *Def types to their original form, with no metadata attached. Instead, new *DefWithMeta types are introduced that alias the plain definition types and add extra generic parameters. This way the only code that needs to deal with the extra metadata parameters is the compiler code that reads and writes them - the existence of this metadata is transparent to the runtime, as it should be. PR Close #26203
This commit is contained in:

committed by
Jason Aden

parent
b0070dfb9a
commit
79466baef8
@ -26,11 +26,7 @@ export interface NgModuleTransitiveScopes {
|
||||
exported: {directives: Set<any>; pipes: Set<any>;};
|
||||
}
|
||||
|
||||
/**
|
||||
* A version of {@link NgModuleDef} that represents the runtime type shape only, and excludes
|
||||
* metadata parameters.
|
||||
*/
|
||||
export type NgModuleDefInternal<T> = NgModuleDef<T, any, any, any>;
|
||||
export type NgModuleDefWithMeta<T, Declarations, Imports, Exports> = NgModuleDef<T>;
|
||||
|
||||
/**
|
||||
* Runtime link information for NgModules.
|
||||
@ -42,7 +38,7 @@ export type NgModuleDefInternal<T> = NgModuleDef<T, any, any, any>;
|
||||
* never create the object directly since the shape of this object
|
||||
* can change between versions.
|
||||
*/
|
||||
export interface NgModuleDef<T, Declarations, Imports, Exports> {
|
||||
export interface NgModuleDef<T> {
|
||||
/** Token representing the module. Used by DI. */
|
||||
type: T;
|
||||
|
||||
|
Reference in New Issue
Block a user