fix(ivy): detect ngOnChanges as a non-static method (#24862)
Previously ngtsc had a bug where it would only detect the presence of ngOnChanges as a static method. This commit flips the condition and only recognizes ngOnChanges as a non-static method. PR Close #24862
This commit is contained in:

committed by
Victor Berchet

parent
5d7005eef5
commit
6f8ec256ef
@ -127,9 +127,9 @@ export function extractDirectiveMetadata(
|
|||||||
const host = extractHostBindings(directive, decoratedElements, reflector, checker, coreModule);
|
const host = extractHostBindings(directive, decoratedElements, reflector, checker, coreModule);
|
||||||
|
|
||||||
// Determine if `ngOnChanges` is a lifecycle hook defined on the component.
|
// Determine if `ngOnChanges` is a lifecycle hook defined on the component.
|
||||||
const usesOnChanges = members.find(
|
const usesOnChanges = members.some(
|
||||||
member => member.isStatic && member.kind === ClassMemberKind.Method &&
|
member => !member.isStatic && member.kind === ClassMemberKind.Method &&
|
||||||
member.name === 'ngOnChanges') !== undefined;
|
member.name === 'ngOnChanges');
|
||||||
|
|
||||||
// Detect if the component inherits from another class
|
// Detect if the component inherits from another class
|
||||||
const usesInheritance = clazz.heritageClauses !== undefined &&
|
const usesInheritance = clazz.heritageClauses !== undefined &&
|
||||||
|
Reference in New Issue
Block a user