Compare commits

...

4 commits

Author SHA1 Message Date
Andy Hanson 405478e4d1 Merge branch 'master' into equals_error 2018-11-15 17:11:04 -08:00
Andy Hanson dafd33e8af Merge branch 'master' into equals_error 2018-10-22 09:22:07 -07:00
Andy Hanson 107cb982ef Handle literals and literal unions 2018-09-20 16:17:17 -07:00
Andy Hanson b36e5de6f4 Improve error message for == of two different types 2018-09-19 17:37:25 -07:00
9 changed files with 241 additions and 192 deletions

View file

@ -22449,7 +22449,20 @@ namespace ts {
const leftStr = typeToString(leftType);
const rightStr = typeToString(rightType);
const errNode = errorNode || operatorToken;
if (!tryGiveBetterPrimaryError(errNode, leftStr, rightStr)) {
const equalsInfo = getEqualsInfo(operatorToken.kind);
if (equalsInfo !== undefined) {
const explicitConversion = getExplicitConversion(leftType, rightType);
if (explicitConversion) {
const diag = explicitConversion.side === "left"
? Diagnostics.Types_0_and_1_have_no_overlap_Consider_explicitly_converting_the_left_side_using_2_x
: Diagnostics.Types_0_and_1_have_no_overlap_Consider_explicitly_converting_the_right_side_using_2_x;
error(errNode, diag, leftStr, rightStr, explicitConversion.conversionFunctionName);
}
else {
error(errNode, Diagnostics.This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap, String(!equalsInfo), leftStr, rightStr);
}
}
else {
error(
errNode,
Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2,
@ -22459,20 +22472,48 @@ namespace ts {
);
}
}
}
function tryGiveBetterPrimaryError(errNode: Node, leftStr: string, rightStr: string) {
switch (operatorToken.kind) {
case SyntaxKind.EqualsEqualsEqualsToken:
case SyntaxKind.EqualsEqualsToken:
return error(errNode, Diagnostics.This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap, "false", leftStr, rightStr);
case SyntaxKind.ExclamationEqualsEqualsToken:
case SyntaxKind.ExclamationEqualsToken:
return error(errNode, Diagnostics.This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap, "true", leftStr, rightStr);
}
return undefined;
function getEqualsInfo(operatorToken: SyntaxKind): boolean | undefined {
switch (operatorToken) {
case SyntaxKind.EqualsEqualsEqualsToken:
case SyntaxKind.EqualsEqualsToken:
return true;
case SyntaxKind.ExclamationEqualsEqualsToken:
case SyntaxKind.ExclamationEqualsToken:
return false;
default:
return undefined;
}
}
interface ExplicitConversion {
readonly side: "left" | "right";
readonly conversionFunctionName: string;
}
function getExplicitConversion(left: Type, right: Type): ExplicitConversion | undefined {
const convertLeft = getFunctionNameToConvertToType(right, left);
if (convertLeft) return { side: "left", conversionFunctionName: convertLeft };
const convertRight = getFunctionNameToConvertToType(left, right);
if (convertRight) return { side: "right", conversionFunctionName: convertRight };
return undefined;
}
function getFunctionNameToConvertToType(to: Type, from: Type): string | undefined {
return typeOrTypesHaveFlags(to, TypeFlags.StringLike) && !typeOrTypesHaveFlags(from, TypeFlags.StringLike)
? "String"
: typeOrTypesHaveFlags(to, TypeFlags.NumberLike) && !typeOrTypesHaveFlags(from, TypeFlags.NumberLike)
? "Number"
: typeOrTypesHaveFlags(to, TypeFlags.BooleanLike) && !typeOrTypesHaveFlags(from, TypeFlags.BooleanLike)
? "Boolean"
: undefined;
}
function typeOrTypesHaveFlags(type: Type, flags: TypeFlags): boolean {
return (type.flags & TypeFlags.Union ? (type as UnionType).types : [type]).every(t => !!(t.flags & flags));
}
function isYieldExpressionInClass(node: YieldExpression): boolean {
let current: Node = node;
let parent = node.parent;

View file

@ -2128,6 +2128,14 @@
"category": "Error",
"code": 2588
},
"Types '{0}' and '{1}' have no overlap. Consider explicitly converting the left side using `{2}(x)`.": {
"category": "Error",
"code": 2589
},
"Types '{0}' and '{1}' have no overlap. Consider explicitly converting the right side using `{2}(x)`.": {
"category": "Error",
"code": 2590
},
"JSX element attributes type '{0}' may not be a union type.": {
"category": "Error",
"code": 2600

View file

@ -5523,7 +5523,7 @@ var x = 10;`
);
const errorResult = <protocol.Diagnostic[]>session.executeCommand(getErrRequest).response;
assert.isTrue(errorResult.length === 1);
assert.equal(errorResult[0].code, Diagnostics.This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap.code);
assert.equal(errorResult[0].code, Diagnostics.Types_0_and_1_have_no_overlap_Consider_explicitly_converting_the_left_side_using_2_x.code);
});
it("should report semantic errors for configured js project with '// @ts-check' and skipLibCheck=true", () => {
@ -5550,7 +5550,7 @@ var x = 10;`
);
const errorResult = <protocol.Diagnostic[]>session.executeCommand(getErrRequest).response;
assert.isTrue(errorResult.length === 1);
assert.equal(errorResult[0].code, Diagnostics.This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap.code);
assert.equal(errorResult[0].code, Diagnostics.Types_0_and_1_have_no_overlap_Consider_explicitly_converting_the_left_side_using_2_x.code);
});
it("should report semantic errors for configured js project with checkJs=true and skipLibCheck=true", () => {
@ -5579,7 +5579,7 @@ var x = 10;`
);
const errorResult = <protocol.Diagnostic[]>session.executeCommand(getErrRequest).response;
assert.isTrue(errorResult.length === 1);
assert.equal(errorResult[0].code, Diagnostics.This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap.code);
assert.equal(errorResult[0].code, Diagnostics.Types_0_and_1_have_no_overlap_Consider_explicitly_converting_the_left_side_using_2_x.code);
});
});

View file

@ -70,78 +70,78 @@ tests/cases/conformance/expressions/binaryOperators/comparisonOperator/compariso
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(109,12): error TS2365: Operator '>=' cannot be applied to types 'E' and 'boolean'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(110,12): error TS2365: Operator '>=' cannot be applied to types 'E' and 'string'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(111,12): error TS2365: Operator '>=' cannot be applied to types 'E' and 'void'.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(114,12): error TS2367: This condition will always return 'false' since the types 'number' and 'boolean' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(115,12): error TS2367: This condition will always return 'false' since the types 'number' and 'string' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(116,12): error TS2367: This condition will always return 'false' since the types 'number' and 'void' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(119,12): error TS2367: This condition will always return 'false' since the types 'boolean' and 'number' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(120,12): error TS2367: This condition will always return 'false' since the types 'boolean' and 'string' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(121,12): error TS2367: This condition will always return 'false' since the types 'boolean' and 'void' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(122,12): error TS2367: This condition will always return 'false' since the types 'boolean' and 'E' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(124,12): error TS2367: This condition will always return 'false' since the types 'string' and 'number' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(125,12): error TS2367: This condition will always return 'false' since the types 'string' and 'boolean' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(126,12): error TS2367: This condition will always return 'false' since the types 'string' and 'void' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(127,12): error TS2367: This condition will always return 'false' since the types 'string' and 'E' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(129,12): error TS2367: This condition will always return 'false' since the types 'void' and 'number' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(130,12): error TS2367: This condition will always return 'false' since the types 'void' and 'boolean' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(131,12): error TS2367: This condition will always return 'false' since the types 'void' and 'string' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(132,12): error TS2367: This condition will always return 'false' since the types 'void' and 'E' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(135,12): error TS2367: This condition will always return 'false' since the types 'E' and 'boolean' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(136,12): error TS2367: This condition will always return 'false' since the types 'E' and 'string' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(137,12): error TS2367: This condition will always return 'false' since the types 'E' and 'void' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(140,12): error TS2367: This condition will always return 'true' since the types 'number' and 'boolean' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(141,12): error TS2367: This condition will always return 'true' since the types 'number' and 'string' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(142,12): error TS2367: This condition will always return 'true' since the types 'number' and 'void' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(145,12): error TS2367: This condition will always return 'true' since the types 'boolean' and 'number' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(146,12): error TS2367: This condition will always return 'true' since the types 'boolean' and 'string' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(147,12): error TS2367: This condition will always return 'true' since the types 'boolean' and 'void' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(148,12): error TS2367: This condition will always return 'true' since the types 'boolean' and 'E' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(150,12): error TS2367: This condition will always return 'true' since the types 'string' and 'number' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(151,12): error TS2367: This condition will always return 'true' since the types 'string' and 'boolean' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(152,12): error TS2367: This condition will always return 'true' since the types 'string' and 'void' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(153,12): error TS2367: This condition will always return 'true' since the types 'string' and 'E' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(155,12): error TS2367: This condition will always return 'true' since the types 'void' and 'number' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(156,12): error TS2367: This condition will always return 'true' since the types 'void' and 'boolean' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(157,12): error TS2367: This condition will always return 'true' since the types 'void' and 'string' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(158,12): error TS2367: This condition will always return 'true' since the types 'void' and 'E' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(161,12): error TS2367: This condition will always return 'true' since the types 'E' and 'boolean' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(162,12): error TS2367: This condition will always return 'true' since the types 'E' and 'string' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(163,12): error TS2367: This condition will always return 'true' since the types 'E' and 'void' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(166,12): error TS2367: This condition will always return 'false' since the types 'number' and 'boolean' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(167,12): error TS2367: This condition will always return 'false' since the types 'number' and 'string' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(168,12): error TS2367: This condition will always return 'false' since the types 'number' and 'void' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(171,12): error TS2367: This condition will always return 'false' since the types 'boolean' and 'number' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(172,12): error TS2367: This condition will always return 'false' since the types 'boolean' and 'string' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(173,12): error TS2367: This condition will always return 'false' since the types 'boolean' and 'void' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(174,12): error TS2367: This condition will always return 'false' since the types 'boolean' and 'E' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(176,12): error TS2367: This condition will always return 'false' since the types 'string' and 'number' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(177,12): error TS2367: This condition will always return 'false' since the types 'string' and 'boolean' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(178,12): error TS2367: This condition will always return 'false' since the types 'string' and 'void' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(179,12): error TS2367: This condition will always return 'false' since the types 'string' and 'E' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(181,12): error TS2367: This condition will always return 'false' since the types 'void' and 'number' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(182,12): error TS2367: This condition will always return 'false' since the types 'void' and 'boolean' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(183,12): error TS2367: This condition will always return 'false' since the types 'void' and 'string' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(184,12): error TS2367: This condition will always return 'false' since the types 'void' and 'E' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(187,12): error TS2367: This condition will always return 'false' since the types 'E' and 'boolean' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(188,12): error TS2367: This condition will always return 'false' since the types 'E' and 'string' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(189,12): error TS2367: This condition will always return 'false' since the types 'E' and 'void' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(192,12): error TS2367: This condition will always return 'true' since the types 'number' and 'boolean' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(193,12): error TS2367: This condition will always return 'true' since the types 'number' and 'string' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(194,12): error TS2367: This condition will always return 'true' since the types 'number' and 'void' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(197,12): error TS2367: This condition will always return 'true' since the types 'boolean' and 'number' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(198,12): error TS2367: This condition will always return 'true' since the types 'boolean' and 'string' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(199,12): error TS2367: This condition will always return 'true' since the types 'boolean' and 'void' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(200,12): error TS2367: This condition will always return 'true' since the types 'boolean' and 'E' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(202,12): error TS2367: This condition will always return 'true' since the types 'string' and 'number' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(203,12): error TS2367: This condition will always return 'true' since the types 'string' and 'boolean' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(204,12): error TS2367: This condition will always return 'true' since the types 'string' and 'void' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(205,12): error TS2367: This condition will always return 'true' since the types 'string' and 'E' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(207,12): error TS2367: This condition will always return 'true' since the types 'void' and 'number' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(208,12): error TS2367: This condition will always return 'true' since the types 'void' and 'boolean' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(209,12): error TS2367: This condition will always return 'true' since the types 'void' and 'string' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(210,12): error TS2367: This condition will always return 'true' since the types 'void' and 'E' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(213,12): error TS2367: This condition will always return 'true' since the types 'E' and 'boolean' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(214,12): error TS2367: This condition will always return 'true' since the types 'E' and 'string' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(215,12): error TS2367: This condition will always return 'true' since the types 'E' and 'void' have no overlap.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(114,12): error TS2589: Types 'number' and 'boolean' have no overlap. Consider explicitly converting the left side using `Boolean(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(115,12): error TS2589: Types 'number' and 'string' have no overlap. Consider explicitly converting the left side using `String(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(116,12): error TS2590: Types 'number' and 'void' have no overlap. Consider explicitly converting the right side using `Number(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(119,12): error TS2589: Types 'boolean' and 'number' have no overlap. Consider explicitly converting the left side using `Number(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(120,12): error TS2589: Types 'boolean' and 'string' have no overlap. Consider explicitly converting the left side using `String(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(121,12): error TS2590: Types 'boolean' and 'void' have no overlap. Consider explicitly converting the right side using `Boolean(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(122,12): error TS2589: Types 'boolean' and 'E' have no overlap. Consider explicitly converting the left side using `Number(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(124,12): error TS2589: Types 'string' and 'number' have no overlap. Consider explicitly converting the left side using `Number(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(125,12): error TS2589: Types 'string' and 'boolean' have no overlap. Consider explicitly converting the left side using `Boolean(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(126,12): error TS2590: Types 'string' and 'void' have no overlap. Consider explicitly converting the right side using `String(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(127,12): error TS2589: Types 'string' and 'E' have no overlap. Consider explicitly converting the left side using `Number(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(129,12): error TS2589: Types 'void' and 'number' have no overlap. Consider explicitly converting the left side using `Number(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(130,12): error TS2589: Types 'void' and 'boolean' have no overlap. Consider explicitly converting the left side using `Boolean(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(131,12): error TS2589: Types 'void' and 'string' have no overlap. Consider explicitly converting the left side using `String(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(132,12): error TS2589: Types 'void' and 'E' have no overlap. Consider explicitly converting the left side using `Number(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(135,12): error TS2589: Types 'E' and 'boolean' have no overlap. Consider explicitly converting the left side using `Boolean(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(136,12): error TS2589: Types 'E' and 'string' have no overlap. Consider explicitly converting the left side using `String(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(137,12): error TS2590: Types 'E' and 'void' have no overlap. Consider explicitly converting the right side using `Number(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(140,12): error TS2589: Types 'number' and 'boolean' have no overlap. Consider explicitly converting the left side using `Boolean(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(141,12): error TS2589: Types 'number' and 'string' have no overlap. Consider explicitly converting the left side using `String(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(142,12): error TS2590: Types 'number' and 'void' have no overlap. Consider explicitly converting the right side using `Number(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(145,12): error TS2589: Types 'boolean' and 'number' have no overlap. Consider explicitly converting the left side using `Number(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(146,12): error TS2589: Types 'boolean' and 'string' have no overlap. Consider explicitly converting the left side using `String(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(147,12): error TS2590: Types 'boolean' and 'void' have no overlap. Consider explicitly converting the right side using `Boolean(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(148,12): error TS2589: Types 'boolean' and 'E' have no overlap. Consider explicitly converting the left side using `Number(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(150,12): error TS2589: Types 'string' and 'number' have no overlap. Consider explicitly converting the left side using `Number(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(151,12): error TS2589: Types 'string' and 'boolean' have no overlap. Consider explicitly converting the left side using `Boolean(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(152,12): error TS2590: Types 'string' and 'void' have no overlap. Consider explicitly converting the right side using `String(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(153,12): error TS2589: Types 'string' and 'E' have no overlap. Consider explicitly converting the left side using `Number(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(155,12): error TS2589: Types 'void' and 'number' have no overlap. Consider explicitly converting the left side using `Number(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(156,12): error TS2589: Types 'void' and 'boolean' have no overlap. Consider explicitly converting the left side using `Boolean(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(157,12): error TS2589: Types 'void' and 'string' have no overlap. Consider explicitly converting the left side using `String(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(158,12): error TS2589: Types 'void' and 'E' have no overlap. Consider explicitly converting the left side using `Number(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(161,12): error TS2589: Types 'E' and 'boolean' have no overlap. Consider explicitly converting the left side using `Boolean(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(162,12): error TS2589: Types 'E' and 'string' have no overlap. Consider explicitly converting the left side using `String(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(163,12): error TS2590: Types 'E' and 'void' have no overlap. Consider explicitly converting the right side using `Number(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(166,12): error TS2589: Types 'number' and 'boolean' have no overlap. Consider explicitly converting the left side using `Boolean(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(167,12): error TS2589: Types 'number' and 'string' have no overlap. Consider explicitly converting the left side using `String(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(168,12): error TS2590: Types 'number' and 'void' have no overlap. Consider explicitly converting the right side using `Number(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(171,12): error TS2589: Types 'boolean' and 'number' have no overlap. Consider explicitly converting the left side using `Number(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(172,12): error TS2589: Types 'boolean' and 'string' have no overlap. Consider explicitly converting the left side using `String(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(173,12): error TS2590: Types 'boolean' and 'void' have no overlap. Consider explicitly converting the right side using `Boolean(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(174,12): error TS2589: Types 'boolean' and 'E' have no overlap. Consider explicitly converting the left side using `Number(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(176,12): error TS2589: Types 'string' and 'number' have no overlap. Consider explicitly converting the left side using `Number(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(177,12): error TS2589: Types 'string' and 'boolean' have no overlap. Consider explicitly converting the left side using `Boolean(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(178,12): error TS2590: Types 'string' and 'void' have no overlap. Consider explicitly converting the right side using `String(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(179,12): error TS2589: Types 'string' and 'E' have no overlap. Consider explicitly converting the left side using `Number(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(181,12): error TS2589: Types 'void' and 'number' have no overlap. Consider explicitly converting the left side using `Number(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(182,12): error TS2589: Types 'void' and 'boolean' have no overlap. Consider explicitly converting the left side using `Boolean(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(183,12): error TS2589: Types 'void' and 'string' have no overlap. Consider explicitly converting the left side using `String(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(184,12): error TS2589: Types 'void' and 'E' have no overlap. Consider explicitly converting the left side using `Number(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(187,12): error TS2589: Types 'E' and 'boolean' have no overlap. Consider explicitly converting the left side using `Boolean(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(188,12): error TS2589: Types 'E' and 'string' have no overlap. Consider explicitly converting the left side using `String(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(189,12): error TS2590: Types 'E' and 'void' have no overlap. Consider explicitly converting the right side using `Number(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(192,12): error TS2589: Types 'number' and 'boolean' have no overlap. Consider explicitly converting the left side using `Boolean(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(193,12): error TS2589: Types 'number' and 'string' have no overlap. Consider explicitly converting the left side using `String(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(194,12): error TS2590: Types 'number' and 'void' have no overlap. Consider explicitly converting the right side using `Number(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(197,12): error TS2589: Types 'boolean' and 'number' have no overlap. Consider explicitly converting the left side using `Number(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(198,12): error TS2589: Types 'boolean' and 'string' have no overlap. Consider explicitly converting the left side using `String(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(199,12): error TS2590: Types 'boolean' and 'void' have no overlap. Consider explicitly converting the right side using `Boolean(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(200,12): error TS2589: Types 'boolean' and 'E' have no overlap. Consider explicitly converting the left side using `Number(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(202,12): error TS2589: Types 'string' and 'number' have no overlap. Consider explicitly converting the left side using `Number(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(203,12): error TS2589: Types 'string' and 'boolean' have no overlap. Consider explicitly converting the left side using `Boolean(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(204,12): error TS2590: Types 'string' and 'void' have no overlap. Consider explicitly converting the right side using `String(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(205,12): error TS2589: Types 'string' and 'E' have no overlap. Consider explicitly converting the left side using `Number(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(207,12): error TS2589: Types 'void' and 'number' have no overlap. Consider explicitly converting the left side using `Number(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(208,12): error TS2589: Types 'void' and 'boolean' have no overlap. Consider explicitly converting the left side using `Boolean(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(209,12): error TS2589: Types 'void' and 'string' have no overlap. Consider explicitly converting the left side using `String(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(210,12): error TS2589: Types 'void' and 'E' have no overlap. Consider explicitly converting the left side using `Number(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(213,12): error TS2589: Types 'E' and 'boolean' have no overlap. Consider explicitly converting the left side using `Boolean(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(214,12): error TS2589: Types 'E' and 'string' have no overlap. Consider explicitly converting the left side using `String(x)`.
tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts(215,12): error TS2590: Types 'E' and 'void' have no overlap. Consider explicitly converting the right side using `Number(x)`.
==== tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNoRelationshipPrimitiveType.ts (144 errors) ====
@ -404,247 +404,247 @@ tests/cases/conformance/expressions/binaryOperators/comparisonOperator/compariso
// operator ==
var r5a1 = a == b;
~~~~~~
!!! error TS2367: This condition will always return 'false' since the types 'number' and 'boolean' have no overlap.
!!! error TS2589: Types 'number' and 'boolean' have no overlap. Consider explicitly converting the left side using `Boolean(x)`.
var r5a1 = a == c;
~~~~~~
!!! error TS2367: This condition will always return 'false' since the types 'number' and 'string' have no overlap.
!!! error TS2589: Types 'number' and 'string' have no overlap. Consider explicitly converting the left side using `String(x)`.
var r5a1 = a == d;
~~~~~~
!!! error TS2367: This condition will always return 'false' since the types 'number' and 'void' have no overlap.
!!! error TS2590: Types 'number' and 'void' have no overlap. Consider explicitly converting the right side using `Number(x)`.
var r5a1 = a == e; // no error, expected
var r5b1 = b == a;
~~~~~~
!!! error TS2367: This condition will always return 'false' since the types 'boolean' and 'number' have no overlap.
!!! error TS2589: Types 'boolean' and 'number' have no overlap. Consider explicitly converting the left side using `Number(x)`.
var r5b1 = b == c;
~~~~~~
!!! error TS2367: This condition will always return 'false' since the types 'boolean' and 'string' have no overlap.
!!! error TS2589: Types 'boolean' and 'string' have no overlap. Consider explicitly converting the left side using `String(x)`.
var r5b1 = b == d;
~~~~~~
!!! error TS2367: This condition will always return 'false' since the types 'boolean' and 'void' have no overlap.
!!! error TS2590: Types 'boolean' and 'void' have no overlap. Consider explicitly converting the right side using `Boolean(x)`.
var r5b1 = b == e;
~~~~~~
!!! error TS2367: This condition will always return 'false' since the types 'boolean' and 'E' have no overlap.
!!! error TS2589: Types 'boolean' and 'E' have no overlap. Consider explicitly converting the left side using `Number(x)`.
var r5c1 = c == a;
~~~~~~
!!! error TS2367: This condition will always return 'false' since the types 'string' and 'number' have no overlap.
!!! error TS2589: Types 'string' and 'number' have no overlap. Consider explicitly converting the left side using `Number(x)`.
var r5c1 = c == b;
~~~~~~
!!! error TS2367: This condition will always return 'false' since the types 'string' and 'boolean' have no overlap.
!!! error TS2589: Types 'string' and 'boolean' have no overlap. Consider explicitly converting the left side using `Boolean(x)`.
var r5c1 = c == d;
~~~~~~
!!! error TS2367: This condition will always return 'false' since the types 'string' and 'void' have no overlap.
!!! error TS2590: Types 'string' and 'void' have no overlap. Consider explicitly converting the right side using `String(x)`.
var r5c1 = c == e;
~~~~~~
!!! error TS2367: This condition will always return 'false' since the types 'string' and 'E' have no overlap.
!!! error TS2589: Types 'string' and 'E' have no overlap. Consider explicitly converting the left side using `Number(x)`.
var r5d1 = d == a;
~~~~~~
!!! error TS2367: This condition will always return 'false' since the types 'void' and 'number' have no overlap.
!!! error TS2589: Types 'void' and 'number' have no overlap. Consider explicitly converting the left side using `Number(x)`.
var r5d1 = d == b;
~~~~~~
!!! error TS2367: This condition will always return 'false' since the types 'void' and 'boolean' have no overlap.
!!! error TS2589: Types 'void' and 'boolean' have no overlap. Consider explicitly converting the left side using `Boolean(x)`.
var r5d1 = d == c;
~~~~~~
!!! error TS2367: This condition will always return 'false' since the types 'void' and 'string' have no overlap.
!!! error TS2589: Types 'void' and 'string' have no overlap. Consider explicitly converting the left side using `String(x)`.
var r5d1 = d == e;
~~~~~~
!!! error TS2367: This condition will always return 'false' since the types 'void' and 'E' have no overlap.
!!! error TS2589: Types 'void' and 'E' have no overlap. Consider explicitly converting the left side using `Number(x)`.
var r5e1 = e == a; // no error, expected
var r5e1 = e == b;
~~~~~~
!!! error TS2367: This condition will always return 'false' since the types 'E' and 'boolean' have no overlap.
!!! error TS2589: Types 'E' and 'boolean' have no overlap. Consider explicitly converting the left side using `Boolean(x)`.
var r5e1 = e == c;
~~~~~~
!!! error TS2367: This condition will always return 'false' since the types 'E' and 'string' have no overlap.
!!! error TS2589: Types 'E' and 'string' have no overlap. Consider explicitly converting the left side using `String(x)`.
var r5e1 = e == d;
~~~~~~
!!! error TS2367: This condition will always return 'false' since the types 'E' and 'void' have no overlap.
!!! error TS2590: Types 'E' and 'void' have no overlap. Consider explicitly converting the right side using `Number(x)`.
// operator !=
var r6a1 = a != b;
~~~~~~
!!! error TS2367: This condition will always return 'true' since the types 'number' and 'boolean' have no overlap.
!!! error TS2589: Types 'number' and 'boolean' have no overlap. Consider explicitly converting the left side using `Boolean(x)`.
var r6a1 = a != c;
~~~~~~
!!! error TS2367: This condition will always return 'true' since the types 'number' and 'string' have no overlap.
!!! error TS2589: Types 'number' and 'string' have no overlap. Consider explicitly converting the left side using `String(x)`.
var r6a1 = a != d;
~~~~~~
!!! error TS2367: This condition will always return 'true' since the types 'number' and 'void' have no overlap.
!!! error TS2590: Types 'number' and 'void' have no overlap. Consider explicitly converting the right side using `Number(x)`.
var r6a1 = a != e; // no error, expected
var r6b1 = b != a;
~~~~~~
!!! error TS2367: This condition will always return 'true' since the types 'boolean' and 'number' have no overlap.
!!! error TS2589: Types 'boolean' and 'number' have no overlap. Consider explicitly converting the left side using `Number(x)`.
var r6b1 = b != c;
~~~~~~
!!! error TS2367: This condition will always return 'true' since the types 'boolean' and 'string' have no overlap.
!!! error TS2589: Types 'boolean' and 'string' have no overlap. Consider explicitly converting the left side using `String(x)`.
var r6b1 = b != d;
~~~~~~
!!! error TS2367: This condition will always return 'true' since the types 'boolean' and 'void' have no overlap.
!!! error TS2590: Types 'boolean' and 'void' have no overlap. Consider explicitly converting the right side using `Boolean(x)`.
var r6b1 = b != e;
~~~~~~
!!! error TS2367: This condition will always return 'true' since the types 'boolean' and 'E' have no overlap.
!!! error TS2589: Types 'boolean' and 'E' have no overlap. Consider explicitly converting the left side using `Number(x)`.
var r6c1 = c != a;
~~~~~~
!!! error TS2367: This condition will always return 'true' since the types 'string' and 'number' have no overlap.
!!! error TS2589: Types 'string' and 'number' have no overlap. Consider explicitly converting the left side using `Number(x)`.
var r6c1 = c != b;
~~~~~~
!!! error TS2367: This condition will always return 'true' since the types 'string' and 'boolean' have no overlap.
!!! error TS2589: Types 'string' and 'boolean' have no overlap. Consider explicitly converting the left side using `Boolean(x)`.
var r6c1 = c != d;
~~~~~~
!!! error TS2367: This condition will always return 'true' since the types 'string' and 'void' have no overlap.
!!! error TS2590: Types 'string' and 'void' have no overlap. Consider explicitly converting the right side using `String(x)`.
var r6c1 = c != e;
~~~~~~
!!! error TS2367: This condition will always return 'true' since the types 'string' and 'E' have no overlap.
!!! error TS2589: Types 'string' and 'E' have no overlap. Consider explicitly converting the left side using `Number(x)`.
var r6d1 = d != a;
~~~~~~
!!! error TS2367: This condition will always return 'true' since the types 'void' and 'number' have no overlap.
!!! error TS2589: Types 'void' and 'number' have no overlap. Consider explicitly converting the left side using `Number(x)`.
var r6d1 = d != b;
~~~~~~
!!! error TS2367: This condition will always return 'true' since the types 'void' and 'boolean' have no overlap.
!!! error TS2589: Types 'void' and 'boolean' have no overlap. Consider explicitly converting the left side using `Boolean(x)`.
var r6d1 = d != c;
~~~~~~
!!! error TS2367: This condition will always return 'true' since the types 'void' and 'string' have no overlap.
!!! error TS2589: Types 'void' and 'string' have no overlap. Consider explicitly converting the left side using `String(x)`.
var r6d1 = d != e;
~~~~~~
!!! error TS2367: This condition will always return 'true' since the types 'void' and 'E' have no overlap.
!!! error TS2589: Types 'void' and 'E' have no overlap. Consider explicitly converting the left side using `Number(x)`.
var r6e1 = e != a; // no error, expected
var r6e1 = e != b;
~~~~~~
!!! error TS2367: This condition will always return 'true' since the types 'E' and 'boolean' have no overlap.
!!! error TS2589: Types 'E' and 'boolean' have no overlap. Consider explicitly converting the left side using `Boolean(x)`.
var r6e1 = e != c;
~~~~~~
!!! error TS2367: This condition will always return 'true' since the types 'E' and 'string' have no overlap.
!!! error TS2589: Types 'E' and 'string' have no overlap. Consider explicitly converting the left side using `String(x)`.
var r6e1 = e != d;
~~~~~~
!!! error TS2367: This condition will always return 'true' since the types 'E' and 'void' have no overlap.
!!! error TS2590: Types 'E' and 'void' have no overlap. Consider explicitly converting the right side using `Number(x)`.
// operator ===
var r7a1 = a === b;
~~~~~~~
!!! error TS2367: This condition will always return 'false' since the types 'number' and 'boolean' have no overlap.
!!! error TS2589: Types 'number' and 'boolean' have no overlap. Consider explicitly converting the left side using `Boolean(x)`.
var r7a1 = a === c;
~~~~~~~
!!! error TS2367: This condition will always return 'false' since the types 'number' and 'string' have no overlap.
!!! error TS2589: Types 'number' and 'string' have no overlap. Consider explicitly converting the left side using `String(x)`.
var r7a1 = a === d;
~~~~~~~
!!! error TS2367: This condition will always return 'false' since the types 'number' and 'void' have no overlap.
!!! error TS2590: Types 'number' and 'void' have no overlap. Consider explicitly converting the right side using `Number(x)`.
var r7a1 = a === e; // no error, expected
var r7b1 = b === a;
~~~~~~~
!!! error TS2367: This condition will always return 'false' since the types 'boolean' and 'number' have no overlap.
!!! error TS2589: Types 'boolean' and 'number' have no overlap. Consider explicitly converting the left side using `Number(x)`.
var r7b1 = b === c;
~~~~~~~
!!! error TS2367: This condition will always return 'false' since the types 'boolean' and 'string' have no overlap.
!!! error TS2589: Types 'boolean' and 'string' have no overlap. Consider explicitly converting the left side using `String(x)`.
var r7b1 = b === d;
~~~~~~~
!!! error TS2367: This condition will always return 'false' since the types 'boolean' and 'void' have no overlap.
!!! error TS2590: Types 'boolean' and 'void' have no overlap. Consider explicitly converting the right side using `Boolean(x)`.
var r7b1 = b === e;
~~~~~~~
!!! error TS2367: This condition will always return 'false' since the types 'boolean' and 'E' have no overlap.
!!! error TS2589: Types 'boolean' and 'E' have no overlap. Consider explicitly converting the left side using `Number(x)`.
var r7c1 = c === a;
~~~~~~~
!!! error TS2367: This condition will always return 'false' since the types 'string' and 'number' have no overlap.
!!! error TS2589: Types 'string' and 'number' have no overlap. Consider explicitly converting the left side using `Number(x)`.
var r7c1 = c === b;
~~~~~~~
!!! error TS2367: This condition will always return 'false' since the types 'string' and 'boolean' have no overlap.
!!! error TS2589: Types 'string' and 'boolean' have no overlap. Consider explicitly converting the left side using `Boolean(x)`.
var r7c1 = c === d;
~~~~~~~
!!! error TS2367: This condition will always return 'false' since the types 'string' and 'void' have no overlap.
!!! error TS2590: Types 'string' and 'void' have no overlap. Consider explicitly converting the right side using `String(x)`.
var r7c1 = c === e;
~~~~~~~
!!! error TS2367: This condition will always return 'false' since the types 'string' and 'E' have no overlap.
!!! error TS2589: Types 'string' and 'E' have no overlap. Consider explicitly converting the left side using `Number(x)`.
var r7d1 = d === a;
~~~~~~~
!!! error TS2367: This condition will always return 'false' since the types 'void' and 'number' have no overlap.
!!! error TS2589: Types 'void' and 'number' have no overlap. Consider explicitly converting the left side using `Number(x)`.
var r7d1 = d === b;
~~~~~~~
!!! error TS2367: This condition will always return 'false' since the types 'void' and 'boolean' have no overlap.
!!! error TS2589: Types 'void' and 'boolean' have no overlap. Consider explicitly converting the left side using `Boolean(x)`.
var r7d1 = d === c;
~~~~~~~
!!! error TS2367: This condition will always return 'false' since the types 'void' and 'string' have no overlap.
!!! error TS2589: Types 'void' and 'string' have no overlap. Consider explicitly converting the left side using `String(x)`.
var r7d1 = d === e;
~~~~~~~
!!! error TS2367: This condition will always return 'false' since the types 'void' and 'E' have no overlap.
!!! error TS2589: Types 'void' and 'E' have no overlap. Consider explicitly converting the left side using `Number(x)`.
var r7e1 = e === a; // no error, expected
var r7e1 = e === b;
~~~~~~~
!!! error TS2367: This condition will always return 'false' since the types 'E' and 'boolean' have no overlap.
!!! error TS2589: Types 'E' and 'boolean' have no overlap. Consider explicitly converting the left side using `Boolean(x)`.
var r7e1 = e === c;
~~~~~~~
!!! error TS2367: This condition will always return 'false' since the types 'E' and 'string' have no overlap.
!!! error TS2589: Types 'E' and 'string' have no overlap. Consider explicitly converting the left side using `String(x)`.
var r7e1 = e === d;
~~~~~~~
!!! error TS2367: This condition will always return 'false' since the types 'E' and 'void' have no overlap.
!!! error TS2590: Types 'E' and 'void' have no overlap. Consider explicitly converting the right side using `Number(x)`.
// operator !==
var r8a1 = a !== b;
~~~~~~~
!!! error TS2367: This condition will always return 'true' since the types 'number' and 'boolean' have no overlap.
!!! error TS2589: Types 'number' and 'boolean' have no overlap. Consider explicitly converting the left side using `Boolean(x)`.
var r8a1 = a !== c;
~~~~~~~
!!! error TS2367: This condition will always return 'true' since the types 'number' and 'string' have no overlap.
!!! error TS2589: Types 'number' and 'string' have no overlap. Consider explicitly converting the left side using `String(x)`.
var r8a1 = a !== d;
~~~~~~~
!!! error TS2367: This condition will always return 'true' since the types 'number' and 'void' have no overlap.
!!! error TS2590: Types 'number' and 'void' have no overlap. Consider explicitly converting the right side using `Number(x)`.
var r8a1 = a !== e; // no error, expected
var r8b1 = b !== a;
~~~~~~~
!!! error TS2367: This condition will always return 'true' since the types 'boolean' and 'number' have no overlap.
!!! error TS2589: Types 'boolean' and 'number' have no overlap. Consider explicitly converting the left side using `Number(x)`.
var r8b1 = b !== c;
~~~~~~~
!!! error TS2367: This condition will always return 'true' since the types 'boolean' and 'string' have no overlap.
!!! error TS2589: Types 'boolean' and 'string' have no overlap. Consider explicitly converting the left side using `String(x)`.
var r8b1 = b !== d;
~~~~~~~
!!! error TS2367: This condition will always return 'true' since the types 'boolean' and 'void' have no overlap.
!!! error TS2590: Types 'boolean' and 'void' have no overlap. Consider explicitly converting the right side using `Boolean(x)`.
var r8b1 = b !== e;
~~~~~~~
!!! error TS2367: This condition will always return 'true' since the types 'boolean' and 'E' have no overlap.
!!! error TS2589: Types 'boolean' and 'E' have no overlap. Consider explicitly converting the left side using `Number(x)`.
var r8c1 = c !== a;
~~~~~~~
!!! error TS2367: This condition will always return 'true' since the types 'string' and 'number' have no overlap.
!!! error TS2589: Types 'string' and 'number' have no overlap. Consider explicitly converting the left side using `Number(x)`.
var r8c1 = c !== b;
~~~~~~~
!!! error TS2367: This condition will always return 'true' since the types 'string' and 'boolean' have no overlap.
!!! error TS2589: Types 'string' and 'boolean' have no overlap. Consider explicitly converting the left side using `Boolean(x)`.
var r8c1 = c !== d;
~~~~~~~
!!! error TS2367: This condition will always return 'true' since the types 'string' and 'void' have no overlap.
!!! error TS2590: Types 'string' and 'void' have no overlap. Consider explicitly converting the right side using `String(x)`.
var r8c1 = c !== e;
~~~~~~~
!!! error TS2367: This condition will always return 'true' since the types 'string' and 'E' have no overlap.
!!! error TS2589: Types 'string' and 'E' have no overlap. Consider explicitly converting the left side using `Number(x)`.
var r8d1 = d !== a;
~~~~~~~
!!! error TS2367: This condition will always return 'true' since the types 'void' and 'number' have no overlap.
!!! error TS2589: Types 'void' and 'number' have no overlap. Consider explicitly converting the left side using `Number(x)`.
var r8d1 = d !== b;
~~~~~~~
!!! error TS2367: This condition will always return 'true' since the types 'void' and 'boolean' have no overlap.
!!! error TS2589: Types 'void' and 'boolean' have no overlap. Consider explicitly converting the left side using `Boolean(x)`.
var r8d1 = d !== c;
~~~~~~~
!!! error TS2367: This condition will always return 'true' since the types 'void' and 'string' have no overlap.
!!! error TS2589: Types 'void' and 'string' have no overlap. Consider explicitly converting the left side using `String(x)`.
var r8d1 = d !== e;
~~~~~~~
!!! error TS2367: This condition will always return 'true' since the types 'void' and 'E' have no overlap.
!!! error TS2589: Types 'void' and 'E' have no overlap. Consider explicitly converting the left side using `Number(x)`.
var r8e1 = e !== a; // no error, expected
var r8e1 = e !== b;
~~~~~~~
!!! error TS2367: This condition will always return 'true' since the types 'E' and 'boolean' have no overlap.
!!! error TS2589: Types 'E' and 'boolean' have no overlap. Consider explicitly converting the left side using `Boolean(x)`.
var r8e1 = e !== c;
~~~~~~~
!!! error TS2367: This condition will always return 'true' since the types 'E' and 'string' have no overlap.
!!! error TS2589: Types 'E' and 'string' have no overlap. Consider explicitly converting the left side using `String(x)`.
var r8e1 = e !== d;
~~~~~~~
!!! error TS2367: This condition will always return 'true' since the types 'E' and 'void' have no overlap.
!!! error TS2590: Types 'E' and 'void' have no overlap. Consider explicitly converting the right side using `Number(x)`.

View file

@ -1,10 +1,10 @@
tests/cases/compiler/expr.ts(87,5): error TS2367: This condition will always return 'false' since the types 'number' and 'string' have no overlap.
tests/cases/compiler/expr.ts(88,5): error TS2367: This condition will always return 'false' since the types 'number' and 'boolean' have no overlap.
tests/cases/compiler/expr.ts(94,5): error TS2367: This condition will always return 'false' since the types 'string' and 'number' have no overlap.
tests/cases/compiler/expr.ts(95,5): error TS2367: This condition will always return 'false' since the types 'string' and 'boolean' have no overlap.
tests/cases/compiler/expr.ts(98,5): error TS2367: This condition will always return 'false' since the types 'string' and 'E' have no overlap.
tests/cases/compiler/expr.ts(115,5): error TS2367: This condition will always return 'false' since the types 'E' and 'string' have no overlap.
tests/cases/compiler/expr.ts(116,5): error TS2367: This condition will always return 'false' since the types 'E' and 'false' have no overlap.
tests/cases/compiler/expr.ts(87,5): error TS2589: Types 'number' and 'string' have no overlap. Consider explicitly converting the left side using `String(x)`.
tests/cases/compiler/expr.ts(88,5): error TS2589: Types 'number' and 'boolean' have no overlap. Consider explicitly converting the left side using `Boolean(x)`.
tests/cases/compiler/expr.ts(94,5): error TS2589: Types 'string' and 'number' have no overlap. Consider explicitly converting the left side using `Number(x)`.
tests/cases/compiler/expr.ts(95,5): error TS2589: Types 'string' and 'boolean' have no overlap. Consider explicitly converting the left side using `Boolean(x)`.
tests/cases/compiler/expr.ts(98,5): error TS2589: Types 'string' and 'E' have no overlap. Consider explicitly converting the left side using `Number(x)`.
tests/cases/compiler/expr.ts(115,5): error TS2589: Types 'E' and 'string' have no overlap. Consider explicitly converting the left side using `String(x)`.
tests/cases/compiler/expr.ts(116,5): error TS2589: Types 'E' and 'false' have no overlap. Consider explicitly converting the left side using `Boolean(x)`.
tests/cases/compiler/expr.ts(142,5): error TS2365: Operator '+' cannot be applied to types 'number' and 'false'.
tests/cases/compiler/expr.ts(143,5): error TS2365: Operator '+' cannot be applied to types 'number' and 'I'.
tests/cases/compiler/expr.ts(161,5): error TS2365: Operator '+' cannot be applied to types 'I' and 'number'.
@ -158,10 +158,10 @@ tests/cases/compiler/expr.ts(242,7): error TS2363: The right-hand side of an ari
n==a;
n==s;
~~~~
!!! error TS2367: This condition will always return 'false' since the types 'number' and 'string' have no overlap.
!!! error TS2589: Types 'number' and 'string' have no overlap. Consider explicitly converting the left side using `String(x)`.
n==b;
~~~~
!!! error TS2367: This condition will always return 'false' since the types 'number' and 'boolean' have no overlap.
!!! error TS2589: Types 'number' and 'boolean' have no overlap. Consider explicitly converting the left side using `Boolean(x)`.
n==i;
n==n;
n==e;
@ -169,15 +169,15 @@ tests/cases/compiler/expr.ts(242,7): error TS2363: The right-hand side of an ari
s==a;
s==n;
~~~~
!!! error TS2367: This condition will always return 'false' since the types 'string' and 'number' have no overlap.
!!! error TS2589: Types 'string' and 'number' have no overlap. Consider explicitly converting the left side using `Number(x)`.
s==b;
~~~~
!!! error TS2367: This condition will always return 'false' since the types 'string' and 'boolean' have no overlap.
!!! error TS2589: Types 'string' and 'boolean' have no overlap. Consider explicitly converting the left side using `Boolean(x)`.
s==i;
s==s;
s==e;
~~~~
!!! error TS2367: This condition will always return 'false' since the types 'string' and 'E' have no overlap.
!!! error TS2589: Types 'string' and 'E' have no overlap. Consider explicitly converting the left side using `Number(x)`.
a==n;
a==s;
@ -196,10 +196,10 @@ tests/cases/compiler/expr.ts(242,7): error TS2363: The right-hand side of an ari
e==n;
e==s;
~~~~
!!! error TS2367: This condition will always return 'false' since the types 'E' and 'string' have no overlap.
!!! error TS2589: Types 'E' and 'string' have no overlap. Consider explicitly converting the left side using `String(x)`.
e==b;
~~~~
!!! error TS2367: This condition will always return 'false' since the types 'E' and 'false' have no overlap.
!!! error TS2589: Types 'E' and 'false' have no overlap. Consider explicitly converting the left side using `Boolean(x)`.
e==a;
e==i;
e==e;

View file

@ -1,6 +1,6 @@
tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts(4,16): error TS7015: Element implicitly has an 'any' type because index expression is not of type 'number'.
tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts(5,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts(6,9): error TS2367: This condition will always return 'false' since the types 'string' and 'number' have no overlap.
tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts(6,9): error TS2589: Types 'string' and 'number' have no overlap. Consider explicitly converting the left side using `Number(x)`.
tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts(8,16): error TS2339: Property 'unknownProperty' does not exist on type 'string'.
tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts(12,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type 'number', but here has type 'string'.
tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts(16,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'j' must be of type 'any', but here has type 'string'.
@ -18,7 +18,7 @@ tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
if (x === 1) {
~~~~~~~
!!! error TS2367: This condition will always return 'false' since the types 'string' and 'number' have no overlap.
!!! error TS2589: Types 'string' and 'number' have no overlap. Consider explicitly converting the left side using `Number(x)`.
}
let a3 = x.unknownProperty;
~~~~~~~~~~~~~~~

View file

@ -47,10 +47,10 @@ tests/cases/compiler/numberVsBigIntOperations.ts(25,43): error TS2365: Operator
tests/cases/compiler/numberVsBigIntOperations.ts(38,1): error TS2365: Operator '>>>=' cannot be applied to types 'bigint' and '1n'.
tests/cases/compiler/numberVsBigIntOperations.ts(39,10): error TS2365: Operator '>>>' cannot be applied to types 'bigint' and '1n'.
tests/cases/compiler/numberVsBigIntOperations.ts(40,8): error TS2736: Operator '+' cannot be applied to type 'bigint'.
tests/cases/compiler/numberVsBigIntOperations.ts(50,10): error TS2367: This condition will always return 'false' since the types 'bigint' and 'number' have no overlap.
tests/cases/compiler/numberVsBigIntOperations.ts(51,10): error TS2367: This condition will always return 'true' since the types 'bigint' and 'number' have no overlap.
tests/cases/compiler/numberVsBigIntOperations.ts(52,10): error TS2367: This condition will always return 'false' since the types 'bigint' and 'number' have no overlap.
tests/cases/compiler/numberVsBigIntOperations.ts(53,10): error TS2367: This condition will always return 'true' since the types 'bigint' and 'number' have no overlap.
tests/cases/compiler/numberVsBigIntOperations.ts(50,10): error TS2589: Types 'bigint' and 'number' have no overlap. Consider explicitly converting the left side using `Number(x)`.
tests/cases/compiler/numberVsBigIntOperations.ts(51,10): error TS2589: Types 'bigint' and 'number' have no overlap. Consider explicitly converting the left side using `Number(x)`.
tests/cases/compiler/numberVsBigIntOperations.ts(52,10): error TS2589: Types 'bigint' and 'number' have no overlap. Consider explicitly converting the left side using `Number(x)`.
tests/cases/compiler/numberVsBigIntOperations.ts(53,10): error TS2589: Types 'bigint' and 'number' have no overlap. Consider explicitly converting the left side using `Number(x)`.
tests/cases/compiler/numberVsBigIntOperations.ts(56,7): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
tests/cases/compiler/numberVsBigIntOperations.ts(56,27): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
tests/cases/compiler/numberVsBigIntOperations.ts(57,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
@ -214,16 +214,16 @@ tests/cases/compiler/numberVsBigIntOperations.ts(93,7): error TS1155: 'const' de
// Trying to compare for equality is likely an error (since 1 == "1" is disallowed)
result = bigInt == num;
~~~~~~~~~~~~~
!!! error TS2367: This condition will always return 'false' since the types 'bigint' and 'number' have no overlap.
!!! error TS2589: Types 'bigint' and 'number' have no overlap. Consider explicitly converting the left side using `Number(x)`.
result = bigInt != num;
~~~~~~~~~~~~~
!!! error TS2367: This condition will always return 'true' since the types 'bigint' and 'number' have no overlap.
!!! error TS2589: Types 'bigint' and 'number' have no overlap. Consider explicitly converting the left side using `Number(x)`.
result = bigInt === num;
~~~~~~~~~~~~~~
!!! error TS2367: This condition will always return 'false' since the types 'bigint' and 'number' have no overlap.
!!! error TS2589: Types 'bigint' and 'number' have no overlap. Consider explicitly converting the left side using `Number(x)`.
result = bigInt !== num;
~~~~~~~~~~~~~~
!!! error TS2367: This condition will always return 'true' since the types 'bigint' and 'number' have no overlap.
!!! error TS2589: Types 'bigint' and 'number' have no overlap. Consider explicitly converting the left side using `Number(x)`.
// Types of arithmetic operations on other types
num = "3" & 5; num = 2 ** false; // should error, but infer number

View file

@ -1,5 +1,5 @@
tests/cases/conformance/types/literal/stringLiteralsAssertionsInEqualityComparisons02.ts(3,9): error TS2367: This condition will always return 'false' since the types '"foo"' and '"baz"' have no overlap.
tests/cases/conformance/types/literal/stringLiteralsAssertionsInEqualityComparisons02.ts(5,9): error TS2367: This condition will always return 'false' since the types 'string' and 'number' have no overlap.
tests/cases/conformance/types/literal/stringLiteralsAssertionsInEqualityComparisons02.ts(5,9): error TS2589: Types 'string' and 'number' have no overlap. Consider explicitly converting the left side using `Number(x)`.
tests/cases/conformance/types/literal/stringLiteralsAssertionsInEqualityComparisons02.ts(5,19): error TS2352: Conversion of type 'string' to type 'number' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
@ -12,7 +12,7 @@ tests/cases/conformance/types/literal/stringLiteralsAssertionsInEqualityComparis
var b = "foo" !== ("bar" as "foo");
var c = "foo" == (<number>"bar");
~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2367: This condition will always return 'false' since the types 'string' and 'number' have no overlap.
!!! error TS2589: Types 'string' and 'number' have no overlap. Consider explicitly converting the left side using `Number(x)`.
~~~~~~~~~~~~~
!!! error TS2352: Conversion of type 'string' to type 'number' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
var d = "foo" === ("bar" as EnhancedString);

View file

@ -1,7 +1,7 @@
tests/cases/conformance/es6/Symbols/symbolType9.ts(3,1): error TS2367: This condition will always return 'false' since the types 'symbol' and 'boolean' have no overlap.
tests/cases/conformance/es6/Symbols/symbolType9.ts(5,1): error TS2367: This condition will always return 'true' since the types 'number' and 'symbol' have no overlap.
tests/cases/conformance/es6/Symbols/symbolType9.ts(7,1): error TS2367: This condition will always return 'false' since the types 'symbol' and 'number' have no overlap.
tests/cases/conformance/es6/Symbols/symbolType9.ts(9,1): error TS2367: This condition will always return 'true' since the types 'boolean' and 'symbol' have no overlap.
tests/cases/conformance/es6/Symbols/symbolType9.ts(3,1): error TS2589: Types 'symbol' and 'boolean' have no overlap. Consider explicitly converting the left side using `Boolean(x)`.
tests/cases/conformance/es6/Symbols/symbolType9.ts(5,1): error TS2590: Types 'number' and 'symbol' have no overlap. Consider explicitly converting the right side using `Number(x)`.
tests/cases/conformance/es6/Symbols/symbolType9.ts(7,1): error TS2589: Types 'symbol' and 'number' have no overlap. Consider explicitly converting the left side using `Number(x)`.
tests/cases/conformance/es6/Symbols/symbolType9.ts(9,1): error TS2590: Types 'boolean' and 'symbol' have no overlap. Consider explicitly converting the right side using `Boolean(x)`.
==== tests/cases/conformance/es6/Symbols/symbolType9.ts (4 errors) ====
@ -9,16 +9,16 @@ tests/cases/conformance/es6/Symbols/symbolType9.ts(9,1): error TS2367: This cond
s == s;
s == true;
~~~~~~~~~
!!! error TS2367: This condition will always return 'false' since the types 'symbol' and 'boolean' have no overlap.
!!! error TS2589: Types 'symbol' and 'boolean' have no overlap. Consider explicitly converting the left side using `Boolean(x)`.
s != s;
0 != s;
~~~~~~
!!! error TS2367: This condition will always return 'true' since the types 'number' and 'symbol' have no overlap.
!!! error TS2590: Types 'number' and 'symbol' have no overlap. Consider explicitly converting the right side using `Number(x)`.
s === s;
s === 1;
~~~~~~~
!!! error TS2367: This condition will always return 'false' since the types 'symbol' and 'number' have no overlap.
!!! error TS2589: Types 'symbol' and 'number' have no overlap. Consider explicitly converting the left side using `Number(x)`.
s !== s;
false !== s;
~~~~~~~~~~~
!!! error TS2367: This condition will always return 'true' since the types 'boolean' and 'symbol' have no overlap.
!!! error TS2590: Types 'boolean' and 'symbol' have no overlap. Consider explicitly converting the right side using `Boolean(x)`.