From 42f3ad8622514e889859249442d2774bfa67e9ad Mon Sep 17 00:00:00 2001 From: Peter Krol Date: Mon, 6 Mar 2023 18:34:34 -0500 Subject: [PATCH] fix: improve extension inheritance --- src/compiler/checker.ts | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 10c99cf77d..3b5270f393 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -50157,23 +50157,21 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { forEach(clause.types, (node) => { if (isIdentifier(node.expression)) { const nodeType = getTypeOfNode(node.expression); - const typeSymbol = nodeType.symbol; - const valueDeclaration = typeSymbol?.valueDeclaration; - if (valueDeclaration) { - const declarationType = getTypeOfNode(valueDeclaration); - if (declarationType.symbol) { - heritageExtensions.add(declarationType.symbol); - } - if (declarationType.flags & TypeFlags.Intersection) { - forEach((declarationType as IntersectionType).types, (type) => { - if (type.symbol) { - heritageExtensions.add(type.symbol); - } - if (type.aliasSymbol) { - heritageExtensions.add(type.aliasSymbol); - } - }) - } + if (nodeType.flags & TypeFlags.Intersection) { + forEach((nodeType as IntersectionType).types, (type) => { + if (type.symbol) { + heritageExtensions.add(type.symbol); + } + if (type.aliasSymbol) { + heritageExtensions.add(type.aliasSymbol); + } + }) + } + if (nodeType.symbol) { + heritageExtensions.add(nodeType.symbol); + } + if (nodeType.aliasSymbol) { + heritageExtensions.add(nodeType.aliasSymbol) } } else if (isCallExpression(node.expression)) { const resolvedSignature = getResolvedSignature(node.expression);