From 6f8ec256ef1cadc43b8d7b91ab26673a4397972f Mon Sep 17 00:00:00 2001 From: Alex Rickabaugh Date: Thu, 12 Jul 2018 14:52:29 -0700 Subject: [PATCH] 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 --- .../compiler-cli/src/ngtsc/annotations/src/directive.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/compiler-cli/src/ngtsc/annotations/src/directive.ts b/packages/compiler-cli/src/ngtsc/annotations/src/directive.ts index 69a4ad1d33..a96cc61ad0 100644 --- a/packages/compiler-cli/src/ngtsc/annotations/src/directive.ts +++ b/packages/compiler-cli/src/ngtsc/annotations/src/directive.ts @@ -127,9 +127,9 @@ export function extractDirectiveMetadata( const host = extractHostBindings(directive, decoratedElements, reflector, checker, coreModule); // Determine if `ngOnChanges` is a lifecycle hook defined on the component. - const usesOnChanges = members.find( - member => member.isStatic && member.kind === ClassMemberKind.Method && - member.name === 'ngOnChanges') !== undefined; + const usesOnChanges = members.some( + member => !member.isStatic && member.kind === ClassMemberKind.Method && + member.name === 'ngOnChanges'); // Detect if the component inherits from another class const usesInheritance = clazz.heritageClauses !== undefined &&