feat(ivy): Add InheritanceDefinitionFeature to support directive inheritance (#24570)
- Adds InheritanceDefinitionFeature to ivy - Ensures that lifecycle hooks are inherited from super classes whether they are defined as directives or not - Directives cannot inherit from Components - Components can inherit from Directives or Components - Ensures that Inputs, Outputs, and Host Bindings are inherited - Ensures that super class Features are run PR Close #24570
This commit is contained in:
@ -108,6 +108,9 @@ export function extractDirectiveMetadata(
|
||||
member => member.isStatic && member.kind === ClassMemberKind.Method &&
|
||||
member.name === 'ngOnChanges') !== undefined;
|
||||
|
||||
// Detect if the component inherits from another class
|
||||
const usesInheritance = clazz.heritageClauses !== undefined &&
|
||||
clazz.heritageClauses.some(hc => hc.token === ts.SyntaxKind.ExtendsKeyword);
|
||||
return {
|
||||
name: clazz.name !.text,
|
||||
deps: getConstructorDependencies(clazz, reflector, isCore),
|
||||
@ -123,7 +126,7 @@ export function extractDirectiveMetadata(
|
||||
outputs: {...outputsFromMeta, ...outputsFromFields},
|
||||
queries: [], selector,
|
||||
type: new WrappedNodeExpr(clazz.name !),
|
||||
typeSourceSpan: null !,
|
||||
typeSourceSpan: null !, usesInheritance,
|
||||
};
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user