Skip to content

Commit a74e9d8

Browse files
authored
Merge pull request microsoft#12158 from Microsoft/fix-literal-comparability-in-relational-comparison-operators
Fix literal comparability in relational comparison operators
2 parents ddf2ad4 + 07c47fe commit a74e9d8

File tree

45 files changed

+1056
-2391
lines changed

Some content is hidden

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

45 files changed

+1056
-2391
lines changed

src/compiler/checker.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14502,6 +14502,8 @@ namespace ts {
1450214502
case SyntaxKind.LessThanEqualsToken:
1450314503
case SyntaxKind.GreaterThanEqualsToken:
1450414504
if (checkForDisallowedESSymbolOperand(operator)) {
14505+
leftType = getBaseTypeOfLiteralType(leftType);
14506+
rightType = getBaseTypeOfLiteralType(rightType);
1450514507
if (!isTypeComparableTo(leftType, rightType) && !isTypeComparableTo(rightType, leftType)) {
1450614508
reportOperatorError();
1450714509
}

tests/baselines/reference/capturedLetConstInLoop1.errors.txt

Lines changed: 0 additions & 128 deletions
This file was deleted.

0 commit comments

Comments
 (0)