@@ -14585,7 +14585,6 @@ namespace ts {
14585
14585
}
14586
14586
// NOTE: do not raise error if right is unknown as related error was already reported
14587
14587
if (!(isTypeAny(rightType) ||
14588
- rightType.flags & TypeFlags.Nullable ||
14589
14588
getSignaturesOfType(rightType, SignatureKind.Call).length ||
14590
14589
getSignaturesOfType(rightType, SignatureKind.Construct).length ||
14591
14590
isTypeSubtypeOf(rightType, globalFunctionType))) {
@@ -14598,6 +14597,8 @@ namespace ts {
14598
14597
if (leftType === silentNeverType || rightType === silentNeverType) {
14599
14598
return silentNeverType;
14600
14599
}
14600
+ leftType = checkNonNullType(leftType, left);
14601
+ rightType = checkNonNullType(rightType, right);
14601
14602
// TypeScript 1.0 spec (April 2014): 4.15.5
14602
14603
// The in operator requires the left operand to be of type Any, the String primitive type, or the Number primitive type,
14603
14604
// and the right operand to be of type Any, an object type, or a type parameter type.
@@ -14952,8 +14953,8 @@ namespace ts {
14952
14953
case SyntaxKind.LessThanEqualsToken:
14953
14954
case SyntaxKind.GreaterThanEqualsToken:
14954
14955
if (checkForDisallowedESSymbolOperand(operator)) {
14955
- leftType = getBaseTypeOfLiteralType(leftType);
14956
- rightType = getBaseTypeOfLiteralType(rightType);
14956
+ leftType = getBaseTypeOfLiteralType(checkNonNullType( leftType, left) );
14957
+ rightType = getBaseTypeOfLiteralType(checkNonNullType( rightType, right) );
14957
14958
if (!isTypeComparableTo(leftType, rightType) && !isTypeComparableTo(rightType, leftType)) {
14958
14959
reportOperatorError();
14959
14960
}
0 commit comments