@@ -21108,8 +21108,11 @@ namespace ts {
21108
21108
signature: Signature,
21109
21109
relation: Map<RelationComparisonResult>,
21110
21110
checkMode: CheckMode,
21111
- reportErrors: boolean) {
21111
+ reportErrors: boolean,
21112
+ containingMessageChain: (() => DiagnosticMessageChain | undefined) | undefined
21113
+ ) {
21112
21114
if (isJsxOpeningLikeElement(node)) {
21115
+ // TODO: Maybe containingMessageChain too?
21113
21116
return checkApplicableSignatureForJsxOpeningLikeElement(node, signature, relation, checkMode, reportErrors);
21114
21117
}
21115
21118
const thisType = getThisTypeOfSignature(signature);
@@ -21137,7 +21140,7 @@ namespace ts {
21137
21140
// we obtain the regular type of any object literal arguments because we may not have inferred complete
21138
21141
// parameter types yet and therefore excess property checks may yield false positives (see #17041).
21139
21142
const checkArgType = checkMode & CheckMode.SkipContextSensitive ? getRegularTypeOfObjectLiteral(argType) : argType;
21140
- if (!checkTypeRelatedToAndOptionallyElaborate(checkArgType, paramType, relation, reportErrors ? arg : undefined, arg, headMessage)) {
21143
+ if (!checkTypeRelatedToAndOptionallyElaborate(checkArgType, paramType, relation, reportErrors ? arg : undefined, arg, headMessage, containingMessageChain )) {
21141
21144
return false;
21142
21145
}
21143
21146
}
@@ -21475,11 +21478,14 @@ namespace ts {
21475
21478
// skip the checkApplicableSignature check.
21476
21479
if (reportErrors) {
21477
21480
if (candidatesForArgumentError) {
21478
- createDiagnosticForNodeFromMessageChain // is what I really want to call
21479
- chainDiagnosticMessages(chain, Diagnostics.Failed_to_find_a_suitable_overload_for_this_call);
21480
- diagnostics.add(createDiagnosticForNode(node, Diagnostics.Failed_to_find_a_suitable_overload_for_this_call));
21481
+ // const related: DiagnosticRelatedInformation[] = [];
21481
21482
for (const c of candidatesForArgumentError) {
21482
- checkApplicableSignature(node, args, c, assignableRelation, CheckMode.Normal, /*reportErrors*/ true);
21483
+ const chain = chainDiagnosticMessages(chainDiagnosticMessages(undefined, Diagnostics.Overload_0_gave_the_following_error, signatureToString(c)), Diagnostics.Failed_to_find_a_suitable_overload_for_this_call);
21484
+ checkApplicableSignature(node, args, c, assignableRelation, CheckMode.Normal, /*reportErrors*/ true, () => chain);
21485
+ // related.push(argNode)
21486
+ // This is not right; I want them to be siblings
21487
+ // probably this is a new feature :(
21488
+ // chain = chainDiagnosticMessages(chain, msg);
21483
21489
}
21484
21490
}
21485
21491
else if (candidateForArgumentArityError) {
@@ -21514,7 +21520,7 @@ namespace ts {
21514
21520
if (typeArguments || !hasCorrectArity(node, args, candidate, signatureHelpTrailingComma)) {
21515
21521
return undefined;
21516
21522
}
21517
- if (!checkApplicableSignature(node, args, candidate, relation, CheckMode.Normal, /*reportErrors*/ false)) {
21523
+ if (!checkApplicableSignature(node, args, candidate, relation, CheckMode.Normal, /*reportErrors*/ false, /*containingMessageChain*/ undefined )) {
21518
21524
candidatesForArgumentError = [candidate];
21519
21525
return undefined;
21520
21526
}
@@ -21555,7 +21561,7 @@ namespace ts {
21555
21561
else {
21556
21562
checkCandidate = candidate;
21557
21563
}
21558
- if (!checkApplicableSignature(node, args, checkCandidate, relation, argCheckMode, /*reportErrors*/ false)) {
21564
+ if (!checkApplicableSignature(node, args, checkCandidate, relation, argCheckMode, /*reportErrors*/ false, /*containingMessageChain*/ undefined )) {
21559
21565
// Give preference to error candidates that have no rest parameters (as they are more specific)
21560
21566
if (getMinArgumentCount(checkCandidate) <= args.length && args.length <= getParameterCount(checkCandidate)) {
21561
21567
(candidatesForArgumentError || (candidatesForArgumentError = [])).push(checkCandidate);
@@ -21577,7 +21583,7 @@ namespace ts {
21577
21583
continue;
21578
21584
}
21579
21585
}
21580
- if (!checkApplicableSignature(node, args, checkCandidate, relation, argCheckMode, /*reportErrors*/ false)) {
21586
+ if (!checkApplicableSignature(node, args, checkCandidate, relation, argCheckMode, /*reportErrors*/ false, /*containingMessageChain*/ undefined )) {
21581
21587
// Give preference to error candidates that have no rest parameters (as they are more specific)
21582
21588
if (getMinArgumentCount(checkCandidate) <= args.length && args.length <= getParameterCount(checkCandidate)) {
21583
21589
(candidatesForArgumentError || (candidatesForArgumentError = [])).push(checkCandidate);
0 commit comments