@@ -4763,26 +4763,32 @@ namespace ts {
47634763 let targetSignatures = getSignaturesOfType(target, kind);
47644764 let result = Ternary.True;
47654765 let saveErrorInfo = errorInfo;
4766-
4766+
47674767 // Because the "abstractness" of a class is the same across all construct signatures
47684768 // (internally we are checking the corresponding declaration), it is enough to perform
47694769 // the check and report an error once over all pairs of source and target construct signatures.
4770- let sourceErasedSignature = getErasedSignature(s);
4771- let targetErasedSignature = getErasedSignature(t);
4770+ let sourceSig = sourceSignatures[0];
4771+ // Note that in an extends-clause, targetSignatures is stripped, so the check never proceeds.
4772+ let targetSig = targetSignatures[0];
47724773
4773- let sourceReturnType = sourceErasedSignature && getReturnTypeOfSignature(sourceErasedSignature);
4774- let targetReturnType = targetErasedSignature && getReturnTypeOfSignature(targetErasedSignature);
4774+ if (sourceSig && targetSig) {
4775+ let sourceErasedSignature = getErasedSignature(sourceSig);
4776+ let targetErasedSignature = getErasedSignature(targetSig);
47754777
4776- let sourceReturnDecl = sourceReturnType && sourceReturnType.symbol && getDeclarationOfKind(sourceReturnType.symbol, SyntaxKind.ClassDeclaration);
4777- let targetReturnDecl = targetReturnType && targetReturnType.symbol && getDeclarationOfKind(targetReturnType.symbol, SyntaxKind.ClassDeclaration);
4778- let sourceIsAbstract = sourceReturnDecl && sourceReturnDecl.flags & NodeFlags.Abstract;
4779- let targetIsAbstract = targetReturnDecl && targetReturnDecl.flags & NodeFlags.Abstract;
4778+ let sourceReturnType = sourceErasedSignature && getReturnTypeOfSignature(sourceErasedSignature);
4779+ let targetReturnType = targetErasedSignature && getReturnTypeOfSignature(targetErasedSignature);
47804780
4781- if (sourceIsAbstract && !targetIsAbstract) {
4782- if (reportErrors) {
4783- reportError(Diagnostics.Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type);
4781+ let sourceReturnDecl = sourceReturnType && sourceReturnType.symbol && getDeclarationOfKind(sourceReturnType.symbol, SyntaxKind.ClassDeclaration);
4782+ let targetReturnDecl = targetReturnType && targetReturnType.symbol && getDeclarationOfKind(targetReturnType.symbol, SyntaxKind.ClassDeclaration);
4783+ let sourceIsAbstract = sourceReturnDecl && sourceReturnDecl.flags & NodeFlags.Abstract;
4784+ let targetIsAbstract = targetReturnDecl && targetReturnDecl.flags & NodeFlags.Abstract;
4785+
4786+ if (sourceIsAbstract && !targetIsAbstract) {
4787+ if (reportErrors) {
4788+ reportError(Diagnostics.Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type);
4789+ }
4790+ return Ternary.False;
47844791 }
4785- result = Ternary.False;
47864792 }
47874793
47884794 outer: for (let t of targetSignatures) {
0 commit comments