Merge pull request #12158 from Microsoft/fix-literal-comparability-in-relational-comparison-operators

Fix literal comparability in relational comparison operators
This commit is contained in:
Nathan Shively-Sanders
2016-11-15 08:24:06 -08:00
committed by GitHub
45 changed files with 1056 additions and 2391 deletions

View File

@@ -14502,6 +14502,8 @@ namespace ts {
case SyntaxKind.LessThanEqualsToken:
case SyntaxKind.GreaterThanEqualsToken:
if (checkForDisallowedESSymbolOperand(operator)) {
leftType = getBaseTypeOfLiteralType(leftType);
rightType = getBaseTypeOfLiteralType(rightType);
if (!isTypeComparableTo(leftType, rightType) && !isTypeComparableTo(rightType, leftType)) {
reportOperatorError();
}