Skip to content

Commit 3557092

Browse files
authoredAug 26, 2022
Rephrase error message to be 100% technically correct (#50471)
1 parent 71d1911 commit 3557092

File tree

50 files changed

+784
-791
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+784
-791
lines changed
 

‎src/compiler/checker.ts

+7-14
Original file line numberDiff line numberDiff line change
@@ -34582,26 +34582,19 @@ namespace ts {
3458234582
}
3458334583

3458434584
function tryGiveBetterPrimaryError(errNode: Node, maybeMissingAwait: boolean, leftStr: string, rightStr: string) {
34585-
let typeName: string | undefined;
3458634585
switch (operatorToken.kind) {
3458734586
case SyntaxKind.EqualsEqualsEqualsToken:
3458834587
case SyntaxKind.EqualsEqualsToken:
34589-
typeName = "false";
34590-
break;
3459134588
case SyntaxKind.ExclamationEqualsEqualsToken:
3459234589
case SyntaxKind.ExclamationEqualsToken:
34593-
typeName = "true";
34594-
}
34595-
34596-
if (typeName) {
34597-
return errorAndMaybeSuggestAwait(
34598-
errNode,
34599-
maybeMissingAwait,
34600-
Diagnostics.This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap,
34601-
typeName, leftStr, rightStr);
34590+
return errorAndMaybeSuggestAwait(
34591+
errNode,
34592+
maybeMissingAwait,
34593+
Diagnostics.This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap,
34594+
leftStr, rightStr);
34595+
default:
34596+
return undefined;
3460234597
}
34603-
34604-
return undefined;
3460534598
}
3460634599
}
3460734600

‎src/compiler/diagnosticMessages.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1864,7 +1864,7 @@
18641864
"category": "Error",
18651865
"code": 2366
18661866
},
1867-
"This condition will always return '{0}' since the types '{1}' and '{2}' have no overlap.": {
1867+
"This comparison appears to be unintentional because the types '{0}' and '{1}' have no overlap.": {
18681868
"category": "Error",
18691869
"code": 2367
18701870
},

0 commit comments

Comments
 (0)
Please sign in to comment.