Skip to content

Commit d8168f0

Browse files
committed
feat: support class definition as per .d.ts; extending a const.
1 parent e8c990f commit d8168f0

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

src/compiler/checker.ts

+20-1
Original file line numberDiff line numberDiff line change
@@ -49656,7 +49656,26 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
4965649656
forEach(heritage, (clause) => {
4965749657
forEach(clause.types, (node) => {
4965849658
const type = getTypeOfNode(node);
49659-
if (isCallExpression(node.expression)) {
49659+
if (isIdentifier(node.expression)) {
49660+
const links = getNodeLinks(node.expression);
49661+
const declaration = links.resolvedSymbol?.valueDeclaration
49662+
const vType = declaration && checker.getTypeAtLocation(declaration)
49663+
if (vType) {
49664+
if (vType.symbol) {
49665+
heritageExtensions.add(vType.symbol);
49666+
}
49667+
if (vType.flags & TypeFlags.Intersection) {
49668+
forEach((vType as IntersectionType).types, (type2) => {
49669+
if (type2.symbol) {
49670+
heritageExtensions.add(type2.symbol);
49671+
}
49672+
if (type2.aliasSymbol) {
49673+
heritageExtensions.add(type2.aliasSymbol);
49674+
}
49675+
});
49676+
}
49677+
}
49678+
} else if (isCallExpression(node.expression)) {
4966049679
const resolvedSignature = getResolvedSignature(node.expression);
4966149680
const returnType = resolvedSignature.resolvedReturnType
4966249681
if (returnType) {

0 commit comments

Comments
 (0)