8000 Made check more readable · rvdn/TypeScript@dc85415 · GitHub
[go: up one dir, main page]

Skip to content

Commit dc85415

Browse files
author
Arthur Ozga
committed
Made check more readable
1 parent 84326e6 commit dc85415

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/compiler/checker.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4875,17 +4875,19 @@ namespace ts {
48754875
let targetReturnType = getReturnTypeOfSignature(target);
48764876
if (targetReturnType === voidType) return result;
48774877
let sourceReturnType = getReturnTypeOfSignature(source);
4878-
4879-
let targetReturnDecl = targetReturnType.symbol && getDeclarationOfKind(targetReturnType.symbol, SyntaxKind.ClassDeclaration);
4878+
48804879
let sourceReturnDecl = sourceReturnType.symbol && getDeclarationOfKind(sourceReturnType.symbol, SyntaxKind.ClassDeclaration);
4881-
4882-
if(sourceReturnDecl && sourceReturnDecl.flags & NodeFlags.Abstract && (!targetReturnDecl || !(targetReturnDecl.flags & NodeFlags.Abstract))) {
4883-
if(reportErrors) {
4880+
let targetReturnDecl = targetReturnType.symbol && getDeclarationOfKind(targetReturnType.symbol, SyntaxKind.ClassDeclaration);
4881+
let sourceIsAbstract = sourceReturnDecl && sourceReturnDecl.flags & NodeFlags.Abstract;
4882+
let targetIsAbstract = targetReturnDecl && targetReturnDecl.flags & NodeFlags.Abstract;
4883+
4884+
if (sourceIsAbstract && !targetIsAbstract) {
4885+
if (reportErrors) {
48844886
reportError(Diagnostics.Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type);
48854887
}
48864888
return Ternary.False;
48874889
}
4888-
4890+
48894891
return result & isRelatedTo(sourceReturnType, targetReturnType, reportErrors);
48904892
}
48914893

0 commit comments

Comments
 (0)
0