@@ -11706,8 +11706,6 @@ namespace ts {
11706
11706
containingMessageChain: (() => DiagnosticMessageChain | undefined) | undefined,
11707
11707
errorOutputContainer: { errors?: Diagnostic[], skipLogging?: boolean } | undefined
11708
11708
): boolean {
11709
- // TODO: The first case probably still needs to set errorOutputContainer.error to something
11710
- // TODO: Make sure all error logging in dynamic scope sets errorOutputContainer.error instead
11711
11709
if (!node || isOrHasGenericConditional(target)) return false;
11712
11710
if (!checkTypeRelatedTo(source, target, relation, /*errorNode*/ undefined)
11713
11711
&& elaborateDidYouMeanToCallOrConstruct(node, source, target, relation, headMessage, containingMessageChain, errorOutputContainer)) {
@@ -11958,7 +11956,7 @@ namespace ts {
11958
11956
if (moreThanOneRealChildren) {
11959
11957
if (arrayLikeTargetParts !== neverType) {
11960
11958
const realSource = createTupleType(checkJsxChildren(containingElement, CheckMode.Normal));
11961
- const children = generateJsxChildren(containingElement, getInvalidTextualChildDiagnostic)
11959
+ const children = generateJsxChildren(containingElement, getInvalidTextualChildDiagnostic);
11962
11960
result = elaborateElementwise(children, realSource, arrayLikeTargetParts, relation, containingMessageChain, errorOutputContainer) || result;
11963
11961
}
11964
11962
else if (!isTypeRelatedTo(getIndexedAccessType(source, childrenNameType), childrenTargetType, relation)) {
@@ -12418,7 +12416,7 @@ namespace ts {
12418
12416
return getObjectFlags(source) & ObjectFlags.JsxAttributes && !isUnhyphenatedJsxName(sourceProp.escapedName);
12419
12417
}
12420
12418
12421
- /**
12419
+ /**
12422
12420
* Checks if 'source' is related to 'target' (e.g.: is a assignable to).
12423
12421
* @param source The left-hand-side of the relation.
12424
12422
* @param target The right-hand-side of the relation.
@@ -21207,7 +21205,15 @@ namespace ts {
21207
21205
// can be specified by users through attributes property.
21208
21206
const paramType = getEffectiveFirstArgumentForJsxSignature(signature, node);
21209
21207
const attributesType = checkExpressionWithContextualType(node.attributes, paramType, /*inferenceContext*/ undefined, checkMode);
21210
- return checkTypeRelatedToAndOptionallyElaborate(attributesType, paramType, relation, reportErrors ? node.tagName : undefined, node.attributes, undefined, containingMessageChain, errorOutputContainer);
21208
+ return checkTypeRelatedToAndOptionallyElaborate(
21209
+ attributesType,
21210
+ paramType,
21211
+ relation,
21212
+ reportErrors ? node.tagName : undefined,
21213
+ node.attributes,
21214
+ /*headMessage*/ undefined,
21215
+ containingMessageChain,
21216
+ errorOutputContainer);
21211
21217
}
21212
21218
21213
21219
function getSignatureApplicabilityError(
@@ -21263,7 +21269,7 @@ namespace ts {
21263
21269
if (restType) {
21264
21270
const spreadType = getSpreadArgumentType(args, argCount, args.length, restType, /*context*/ undefined);
21265
21271
const errorNode = reportErrors ? argCount < args.length ? args[argCount] : node : undefined;
21266
- if (!checkTypeRelatedTo(spreadType, restType, relation, errorNode, headMessage, undefined, errorOutputContainer)) {
21272
+ if (!checkTypeRelatedTo(spreadType, restType, relation, errorNode, headMessage, /*containingMessageChain*/ undefined, errorOutputContainer)) {
21267
21273
Debug.assert(!reportErrors || !!errorOutputContainer.errors, "rest parameter should have errors when reporting errors");
21268
21274
return errorOutputContainer.errors || [];
21269
21275
}
@@ -21600,34 +21606,38 @@ namespace ts {
21600
21606
if (candidatesForArgumentError) {
21601
21607
if (candidatesForArgumentError.length === 1 || candidatesForArgumentError.length > 3) {
21602
21608
const last = candidatesForArgumentError[candidatesForArgumentError.length - 1];
21603
- let chain: DiagnosticMessageChain | undefined = undefined ;
21609
+ let chain: DiagnosticMessageChain | undefined;
21604
21610
if (candidatesForArgumentError.length > 3) {
21605
21611
chain = chainDiagnosticMessages(chain, Diagnostics.The_last_overload_gave_the_following_error);
21606
21612
chain = chainDiagnosticMessages(chain, Diagnostics.No_suitable_overload_for_this_call);
21607
21613
}
21608
21614
const ds = getSignatureApplicabilityError(node, args, last, assignableRelation, CheckMode.Normal, /*reportErrors*/ true, () => chain);
21609
- Debug.assert(!!ds, "No error for last signature");
21610
21615
if (ds) {
21611
21616
// if elaboration already displayed the error, don't do anything extra
21612
21617
// note that we could do this always here, but getSignatureApplicabilityError is currently not configured to do that
21613
- for (const d of ds as Diagnostic[] ) {
21618
+ for (const d of ds) {
21614
21619
diagnostics.add(d);
21615
21620
}
21616
21621
}
21622
+ else {
21623
+ Debug.assert(false, "No error for last overload signature");
21624
+ }
21617
21625
}
21618
21626
else {
21619
21627
const related: DiagnosticRelatedInformation[] = [];
21620
21628
let i = 0;
21621
21629
for (const c of candidatesForArgumentError) {
21622
21630
i++;
21623
- const chain = () => chainDiagnosticMessages(undefined, Diagnostics.Overload_0_of_1_2_gave_the_following_error, i, candidates.length, signatureToString(c));
21631
+ const chain = () => chainDiagnosticMessages(/*details*/ undefined, Diagnostics.Overload_0_of_1_2_gave_the_following_error, i, candidates.length, signatureToString(c));
21624
21632
const ds = getSignatureApplicabilityError(node, args, c, assignableRelation, CheckMode.Normal, /*reportErrors*/ true, chain);
21625
- Debug.assert(!!ds, "No error for signature (1)");
21626
21633
if (ds) {
21627
- related.push(...ds as Diagnostic[])
21634
+ related.push(...ds);
21635
+ }
21636
+ else {
21637
+ Debug.assert(false, "No error for 3 or fewer overload signatures");
21628
21638
}
21629
21639
}
21630
- diagnostics.add(createDiagnosticForNodeFromMessageChain(node, chainDiagnosticMessages(undefined, Diagnostics.No_suitable_overload_for_this_call), related));
21640
+ diagnostics.add(createDiagnosticForNodeFromMessageChain(node, chainDiagnosticMessages(/*details*/ undefined, Diagnostics.No_suitable_overload_for_this_call), related));
21631
21641
}
21632
21642
}
21633
21643
else if (candidateForArgumentArityError) {
0 commit comments