From de204430ec7968099ae88cb04b85fa6e55f5d1aa Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Thu, 8 Oct 2020 17:17:06 -0700 Subject: [PATCH] PR feedback --- src/compiler/checker.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 031fb724602..0c3fe72e875 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -27335,14 +27335,12 @@ namespace ts { const declCount = length(failed.declaration?.symbol.declarations); const isOverload = declCount > 1; - const implDecl = isOverload ? failed.declaration?.symbol.declarations[declCount - 1] : undefined; - - - if (isOverload && implDecl && nodeIsPresent((implDecl as FunctionLikeDeclaration).body)) { + const implDecl = isOverload ? find(failed.declaration?.symbol.declarations || emptyArray, d => nodeIsPresent((d as FunctionLikeDeclaration).body)) : undefined; + if (implDecl) { const candidate = getSignatureFromDeclaration(implDecl as FunctionLikeDeclaration); const isSingleNonGenericCandidate = !candidate.typeParameters; - if (!!chooseOverload([candidate], assignableRelation, isSingleNonGenericCandidate)) { - addRelatedInfo(diagnostic , createDiagnosticForNode(implDecl, Diagnostics.The_call_would_have_succeeded_against_this_implementation_but_implementation_signatures_of_overloads_are_not_externally_visible)); + if (chooseOverload([candidate], assignableRelation, isSingleNonGenericCandidate)) { + addRelatedInfo(diagnostic, createDiagnosticForNode(implDecl, Diagnostics.The_call_would_have_succeeded_against_this_implementation_but_implementation_signatures_of_overloads_are_not_externally_visible)); } }