Skip to content

Commit 0ea5073

Browse files
author
Kanchalai Tanglertsampan
committed
Report an error when can't infer but do not report an error for other failure to resolve signature cases
1 parent 378f444 commit 0ea5073

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

src/compiler/checker.ts

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13635,12 +13635,6 @@ namespace ts {
1363513635
return result;
1363613636
}
1363713637

13638-
if (isJsxOpeningOrSelfClosingElement) {
13639-
// If there is not result, just return the last one we try as a candidate.
13640-
// We do not report any error here because any error will be handled in "resolveCustomJsxElementAttributesType".
13641-
return candidateForArgumentError;
13642-
}
13643-
1364413638
// No signatures were applicable. Now report errors based on the last applicable signature with
1364513639
// no arguments excluded from assignability checks.
1364613640
// If candidate is undefined, it means that no candidates had a suitable arity. In that case,
@@ -13651,6 +13645,11 @@ namespace ts {
1365113645
// in arguments too early. If possible, we'd like to only type them once we know the correct
1365213646
// overload. However, this matters for the case where the call is correct. When the call is
1365313647
// an error, we don't need to exclude any arguments, although it would cause no harm to do so.
13648+
if (isJsxOpeningOrSelfClosingElement) {
13649+
// If there is not result, just return the last one we try as a candidate.
13650+
// We do not report any error here because any error will be handled in "resolveCustomJsxElementAttributesType".
13651+
return candidateForArgumentError;
13652+
}
1365413653
checkApplicableSignature(node, args, candidateForArgumentError, assignableRelation, /*excludeArgument*/ undefined, /*reportErrors*/ true);
1365513654
}
1365613655
else if (candidateForTypeArgumentError) {
@@ -13671,7 +13670,7 @@ namespace ts {
1367113670
diagnosticChainHead = chainDiagnosticMessages(diagnosticChainHead, headMessage);
1367213671
}
1367313672

13674-
reportNoCommonSupertypeError(inferenceCandidates, (<CallExpression>node).expression || (<TaggedTemplateExpression>node).tag, diagnosticChainHead);
13673+
reportNoCommonSupertypeError(inferenceCandidates, (<JsxOpeningLikeElement>node).tagName || (<CallExpression>node).expression || (<TaggedTemplateExpression>node).tag, diagnosticChainHead);
1367513674
}
1367613675
}
1367713676
else {
@@ -14072,10 +14071,6 @@ namespace ts {
1407214071
links.resolvedSignature = resolvingSignature;
1407314072

1407414073
let callSignature = resolveStatelessJsxOpeningLikeElement(openingLikeElement, elementType, candidatesOutArray);
14075-
if (!callSignature || callSignature === unknownSignature) {
14076-
const callSignatures = elementType && getSignaturesOfType(elementType, SignatureKind.Call);
14077-
callSignature = callSignatures[callSignatures.length - 1];
14078-
}
1407914074
links.resolvedSignature = callSignature;
1408014075
// If signature resolution originated in control flow type analysis (for example to compute the
1408114076
// assigned type in a flow assignment) we don't cache the result as it may be based on temporary

0 commit comments

Comments
 (0)