Skip to content

Commit d8c6f7e

Browse files
committed
fix additional places where class expression should be queried
1 parent 3a08af1 commit d8c6f7e

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/compiler/checker.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5105,8 +5105,8 @@ namespace ts {
51055105
function abstractSignatureRelatedTo(source: Type, sourceSig: Signature, target: Type, targetSig: Signature) {
51065106
if (sourceSig && targetSig) {
51075107

5108-
let sourceDecl = source.symbol && getDeclarationOfKind(source.symbol, SyntaxKind.ClassDeclaration);
5109-
let targetDecl = target.symbol && getDeclarationOfKind(target.symbol, SyntaxKind.ClassDeclaration);
5108+
let sourceDecl = source.symbol && getClassLikeDeclarationOfSymbol(source.symbol);
5109+
let targetDecl = target.symbol && getClassLikeDeclarationOfSymbol(target.symbol);
51105110

51115111
if (!sourceDecl) {
51125112
// If the source object isn't itself a class declaration, it can be freely assigned, regardless
@@ -5120,8 +5120,8 @@ namespace ts {
51205120
let sourceReturnType = sourceErasedSignature && getReturnTypeOfSignature(sourceErasedSignature);
51215121
let targetReturnType = targetErasedSignature && getReturnTypeOfSignature(targetErasedSignature);
51225122

5123-
let sourceReturnDecl = sourceReturnType && sourceReturnType.symbol && getDeclarationOfKind(sourceReturnType.symbol, SyntaxKind.ClassDeclaration);
5124-
let targetReturnDecl = targetReturnType && targetReturnType.symbol && getDeclarationOfKind(targetReturnType.symbol, SyntaxKind.ClassDeclaration);
5123+
let sourceReturnDecl = sourceReturnType && sourceReturnType.symbol && getClassLikeDeclarationOfSymbol(sourceReturnType.symbol);
5124+
let targetReturnDecl = targetReturnType && targetReturnType.symbol && getClassLikeDeclarationOfSymbol(targetReturnType.symbol);
51255125
let sourceIsAbstract = sourceReturnDecl && sourceReturnDecl.flags & NodeFlags.Abstract;
51265126
let targetIsAbstract = targetReturnDecl && targetReturnDecl.flags & NodeFlags.Abstract;
51275127

@@ -8873,7 +8873,7 @@ namespace ts {
88738873
// Note, only class declarations can be declared abstract.
88748874
// In the case of a merged class-module or class-interface declaration,
88758875
// only the class declaration node will have the Abstract flag set.
8876-
let valueDecl = expressionType.symbol && getDeclarationOfKind(expressionType.symbol, SyntaxKind.ClassDeclaration);
8876+
let valueDecl = expressionType.symbol && getClassLikeDeclarationOfSymbol(expressionType.symbol);
88778877
if (valueDecl && valueDecl.flags & NodeFlags.Abstract) {
88788878
error(node, Diagnostics.Cannot_create_an_instance_of_the_abstract_class_0, declarationNameToString(valueDecl.name));
88798879
return resolveErrorCall(node);

0 commit comments

Comments
 (0)