Skip to content

Commit b58932e

Browse files
committed
Fix lint and remove done TODOs
1 parent 67b8ca7 commit b58932e

File tree

1 file changed

+23
-13
lines changed

1 file changed

+23
-13
lines changed

src/compiler/checker.ts

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11706,8 +11706,6 @@ namespace ts {
1170611706
containingMessageChain: (() => DiagnosticMessageChain | undefined) | undefined,
1170711707
errorOutputContainer: { errors?: Diagnostic[], skipLogging?: boolean } | undefined
1170811708
): 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
1171111709
if (!node || isOrHasGenericConditional(target)) return false;
1171211710
if (!checkTypeRelatedTo(source, target, relation, /*errorNode*/ undefined)
1171311711
&& elaborateDidYouMeanToCallOrConstruct(node, source, target, relation, headMessage, containingMessageChain, errorOutputContainer)) {
@@ -11958,7 +11956,7 @@ namespace ts {
1195811956
if (moreThanOneRealChildren) {
1195911957
if (arrayLikeTargetParts !== neverType) {
1196011958
const realSource = createTupleType(checkJsxChildren(containingElement, CheckMode.Normal));
11961-
const children = generateJsxChildren(containingElement, getInvalidTextualChildDiagnostic)
11959+
const children = generateJsxChildren(containingElement, getInvalidTextualChildDiagnostic);
1196211960
result = elaborateElementwise(children, realSource, arrayLikeTargetParts, relation, containingMessageChain, errorOutputContainer) || result;
1196311961
}
1196411962
else if (!isTypeRelatedTo(getIndexedAccessType(source, childrenNameType), childrenTargetType, relation)) {
@@ -12418,7 +12416,7 @@ namespace ts {
1241812416
return getObjectFlags(source) & ObjectFlags.JsxAttributes && !isUnhyphenatedJsxName(sourceProp.escapedName);
1241912417
}
1242012418

12421-
/**
12419+
/**
1242212420
* Checks if 'source' is related to 'target' (e.g.: is a assignable to).
1242312421
* @param source The left-hand-side of the relation.
1242412422
* @param target The right-hand-side of the relation.
@@ -21207,7 +21205,15 @@ namespace ts {
2120721205
// can be specified by users through attributes property.
2120821206
const paramType = getEffectiveFirstArgumentForJsxSignature(signature, node);
2120921207
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);
2121121217
}
2121221218

2121321219
function getSignatureApplicabilityError(
@@ -21263,7 +21269,7 @@ namespace ts {
2126321269
if (restType) {
2126421270
const spreadType = getSpreadArgumentType(args, argCount, args.length, restType, /*context*/ undefined);
2126521271
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)) {
2126721273
Debug.assert(!reportErrors || !!errorOutputContainer.errors, "rest parameter should have errors when reporting errors");
2126821274
return errorOutputContainer.errors || [];
2126921275
}
@@ -21600,34 +21606,38 @@ namespace ts {
2160021606
if (candidatesForArgumentError) {
2160121607
if (candidatesForArgumentError.length === 1 || candidatesForArgumentError.length > 3) {
2160221608
const last = candidatesForArgumentError[candidatesForArgumentError.length - 1];
21603-
let chain: DiagnosticMessageChain | undefined = undefined;
21609+
let chain: DiagnosticMessageChain | undefined;
2160421610
if (candidatesForArgumentError.length > 3) {
2160521611
chain = chainDiagnosticMessages(chain, Diagnostics.The_last_overload_gave_the_following_error);
2160621612
chain = chainDiagnosticMessages(chain, Diagnostics.No_suitable_overload_for_this_call);
2160721613
}
2160821614
const ds = getSignatureApplicabilityError(node, args, last, assignableRelation, CheckMode.Normal, /*reportErrors*/ true, () => chain);
21609-
Debug.assert(!!ds, "No error for last signature");
2161021615
if (ds) {
2161121616
// if elaboration already displayed the error, don't do anything extra
2161221617
// 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) {
2161421619
diagnostics.add(d);
2161521620
}
2161621621
}
21622+
else {
21623+
Debug.assert(false, "No error for last overload signature");
21624+
}
2161721625
}
2161821626
else {
2161921627
const related: DiagnosticRelatedInformation[] = [];
2162021628
let i = 0;
2162121629
for (const c of candidatesForArgumentError) {
2162221630
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));
2162421632
const ds = getSignatureApplicabilityError(node, args, c, assignableRelation, CheckMode.Normal, /*reportErrors*/ true, chain);
21625-
Debug.assert(!!ds, "No error for signature (1)");
2162621633
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");
2162821638
}
2162921639
}
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));
2163121641
}
2163221642
}
2163321643
else if (candidateForArgumentArityError) {

0 commit comments

Comments
 (0)