mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-10 01:43:59 -05:00
Merge pull request #32904 from microsoft/getRidOfCrappyLiterals
Prefer reporting base primitives in various operations
This commit is contained in:
@@ -24086,7 +24086,7 @@ namespace ts {
|
||||
}
|
||||
if (node.operator === SyntaxKind.PlusToken) {
|
||||
if (maybeTypeOfKind(operandType, TypeFlags.BigIntLike)) {
|
||||
error(node.operand, Diagnostics.Operator_0_cannot_be_applied_to_type_1, tokenToString(node.operator), typeToString(operandType));
|
||||
error(node.operand, Diagnostics.Operator_0_cannot_be_applied_to_type_1, tokenToString(node.operator), typeToString(getBaseTypeOfLiteralType(operandType)));
|
||||
}
|
||||
return numberType;
|
||||
}
|
||||
@@ -24521,7 +24521,7 @@ namespace ts {
|
||||
resultType = numberType;
|
||||
}
|
||||
// At least one is assignable to bigint, so check that both are
|
||||
else if (isTypeAssignableToKind(leftType, TypeFlags.BigIntLike) && isTypeAssignableToKind(rightType, TypeFlags.BigIntLike)) {
|
||||
else if (bothAreBigIntLike(leftType, rightType)) {
|
||||
switch (operator) {
|
||||
case SyntaxKind.GreaterThanGreaterThanGreaterThanToken:
|
||||
case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken:
|
||||
@@ -24531,7 +24531,7 @@ namespace ts {
|
||||
}
|
||||
// Exactly one of leftType/rightType is assignable to bigint
|
||||
else {
|
||||
reportOperatorError((awaitedLeft, awaitedRight) => isTypeAssignableToKind(awaitedLeft, TypeFlags.BigIntLike) && isTypeAssignableToKind(awaitedRight, TypeFlags.BigIntLike));
|
||||
reportOperatorError(bothAreBigIntLike);
|
||||
resultType = errorType;
|
||||
}
|
||||
if (leftOk && rightOk) {
|
||||
@@ -24581,9 +24581,9 @@ namespace ts {
|
||||
// might be missing an await without doing an exhaustive check that inserting
|
||||
// await(s) will actually be a completely valid binary expression.
|
||||
const closeEnoughKind = TypeFlags.NumberLike | TypeFlags.BigIntLike | TypeFlags.StringLike | TypeFlags.AnyOrUnknown;
|
||||
reportOperatorError((awaitedLeft, awaitedRight) =>
|
||||
isTypeAssignableToKind(awaitedLeft, closeEnoughKind) &&
|
||||
isTypeAssignableToKind(awaitedRight, closeEnoughKind));
|
||||
reportOperatorError((left, right) =>
|
||||
isTypeAssignableToKind(left, closeEnoughKind) &&
|
||||
isTypeAssignableToKind(right, closeEnoughKind));
|
||||
return anyType;
|
||||
}
|
||||
|
||||
@@ -24651,6 +24651,10 @@ namespace ts {
|
||||
return Debug.fail();
|
||||
}
|
||||
|
||||
function bothAreBigIntLike(left: Type, right: Type): boolean {
|
||||
return isTypeAssignableToKind(left, TypeFlags.BigIntLike) && isTypeAssignableToKind(right, TypeFlags.BigIntLike);
|
||||
}
|
||||
|
||||
function checkAssignmentDeclaration(kind: AssignmentDeclarationKind, rightType: Type) {
|
||||
if (kind === AssignmentDeclarationKind.ModuleExports) {
|
||||
for (const prop of getPropertiesOfObjectType(rightType)) {
|
||||
@@ -24747,18 +24751,23 @@ namespace ts {
|
||||
return false;
|
||||
}
|
||||
|
||||
function reportOperatorError(awaitedTypesAreCompatible?: (left: Type, right: Type) => boolean) {
|
||||
function reportOperatorError(isRelated?: (left: Type, right: Type) => boolean) {
|
||||
let wouldWorkWithAwait = false;
|
||||
const errNode = errorNode || operatorToken;
|
||||
const [leftStr, rightStr] = getTypeNamesForErrorDisplay(leftType, rightType);
|
||||
if (awaitedTypesAreCompatible) {
|
||||
if (isRelated) {
|
||||
const awaitedLeftType = getAwaitedType(leftType);
|
||||
const awaitedRightType = getAwaitedType(rightType);
|
||||
wouldWorkWithAwait = !(awaitedLeftType === leftType && awaitedRightType === rightType)
|
||||
&& !!(awaitedLeftType && awaitedRightType)
|
||||
&& awaitedTypesAreCompatible(awaitedLeftType, awaitedRightType);
|
||||
&& isRelated(awaitedLeftType, awaitedRightType);
|
||||
}
|
||||
|
||||
let effectiveLeft = leftType;
|
||||
let effectiveRight = rightType;
|
||||
if (!wouldWorkWithAwait && isRelated) {
|
||||
[effectiveLeft, effectiveRight] = getBaseTypesIfUnrelated(leftType, rightType, isRelated);
|
||||
}
|
||||
const [leftStr, rightStr] = getTypeNamesForErrorDisplay(effectiveLeft, effectiveRight);
|
||||
if (!tryGiveBetterPrimaryError(errNode, wouldWorkWithAwait, leftStr, rightStr)) {
|
||||
errorAndMaybeSuggestAwait(
|
||||
errNode,
|
||||
@@ -24795,6 +24804,18 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
function getBaseTypesIfUnrelated(leftType: Type, rightType: Type, isRelated: (left: Type, right: Type) => boolean): [Type, Type] {
|
||||
let effectiveLeft = leftType;
|
||||
let effectiveRight = rightType;
|
||||
const leftBase = getBaseTypeOfLiteralType(leftType);
|
||||
const rightBase = getBaseTypeOfLiteralType(rightType);
|
||||
if (!isRelated(leftBase, rightBase)) {
|
||||
effectiveLeft = leftBase;
|
||||
effectiveRight = rightBase;
|
||||
}
|
||||
return [ effectiveLeft, effectiveRight ];
|
||||
}
|
||||
|
||||
function isYieldExpressionInClass(node: YieldExpression): boolean {
|
||||
let current: Node = node;
|
||||
let parent = node.parent;
|
||||
|
||||
@@ -6,17 +6,17 @@ tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOpe
|
||||
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(25,10): error TS2365: Operator '+' cannot be applied to types 'Object' and 'boolean'.
|
||||
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(26,10): error TS2365: Operator '+' cannot be applied to types 'Object' and 'number'.
|
||||
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(27,10): error TS2365: Operator '+' cannot be applied to types 'Object' and 'Object'.
|
||||
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(30,11): error TS2365: Operator '+' cannot be applied to types 'boolean' and 'true'.
|
||||
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(31,11): error TS2365: Operator '+' cannot be applied to types 'true' and 'false'.
|
||||
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(32,11): error TS2365: Operator '+' cannot be applied to types 'true' and '123'.
|
||||
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(30,11): error TS2365: Operator '+' cannot be applied to types 'boolean' and 'boolean'.
|
||||
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(31,11): error TS2365: Operator '+' cannot be applied to types 'boolean' and 'boolean'.
|
||||
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(32,11): error TS2365: Operator '+' cannot be applied to types 'boolean' and 'number'.
|
||||
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(33,11): error TS2365: Operator '+' cannot be applied to types '{}' and '{}'.
|
||||
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(34,11): error TS2365: Operator '+' cannot be applied to types 'number' and 'Number'.
|
||||
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(35,11): error TS2365: Operator '+' cannot be applied to types 'number' and '() => void'.
|
||||
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(36,11): error TS2365: Operator '+' cannot be applied to types 'number' and 'void'.
|
||||
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(37,11): error TS2365: Operator '+' cannot be applied to types 'number' and 'typeof C'.
|
||||
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(38,11): error TS2365: Operator '+' cannot be applied to types 'E.a' and 'C'.
|
||||
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(39,11): error TS2365: Operator '+' cannot be applied to types 'E.a' and 'void'.
|
||||
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(40,11): error TS2365: Operator '+' cannot be applied to types 'E.a' and 'typeof M'.
|
||||
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(38,11): error TS2365: Operator '+' cannot be applied to types 'E' and 'C'.
|
||||
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(39,11): error TS2365: Operator '+' cannot be applied to types 'E' and 'void'.
|
||||
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts(40,11): error TS2365: Operator '+' cannot be applied to types 'E' and 'typeof M'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithInvalidOperands.ts (19 errors) ====
|
||||
@@ -67,13 +67,13 @@ tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOpe
|
||||
// other cases
|
||||
var r10 = a + true;
|
||||
~~~~~~~~
|
||||
!!! error TS2365: Operator '+' cannot be applied to types 'boolean' and 'true'.
|
||||
!!! error TS2365: Operator '+' cannot be applied to types 'boolean' and 'boolean'.
|
||||
var r11 = true + false;
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '+' cannot be applied to types 'true' and 'false'.
|
||||
!!! error TS2365: Operator '+' cannot be applied to types 'boolean' and 'boolean'.
|
||||
var r12 = true + 123;
|
||||
~~~~~~~~~~
|
||||
!!! error TS2365: Operator '+' cannot be applied to types 'true' and '123'.
|
||||
!!! error TS2365: Operator '+' cannot be applied to types 'boolean' and 'number'.
|
||||
var r13 = {} + {};
|
||||
~~~~~~~
|
||||
!!! error TS2365: Operator '+' cannot be applied to types '{}' and '{}'.
|
||||
@@ -91,10 +91,10 @@ tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOpe
|
||||
!!! error TS2365: Operator '+' cannot be applied to types 'number' and 'typeof C'.
|
||||
var r18 = E.a + new C();
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '+' cannot be applied to types 'E.a' and 'C'.
|
||||
!!! error TS2365: Operator '+' cannot be applied to types 'E' and 'C'.
|
||||
var r19 = E.a + C.foo();
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '+' cannot be applied to types 'E.a' and 'void'.
|
||||
!!! error TS2365: Operator '+' cannot be applied to types 'E' and 'void'.
|
||||
var r20 = E.a + M;
|
||||
~~~~~~~
|
||||
!!! error TS2365: Operator '+' cannot be applied to types 'E.a' and 'typeof M'.
|
||||
!!! error TS2365: Operator '+' cannot be applied to types 'E' and 'typeof M'.
|
||||
@@ -5,7 +5,7 @@ tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOpe
|
||||
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(15,10): error TS2365: Operator '+' cannot be applied to types 'Object' and 'null'.
|
||||
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(16,10): error TS2365: Operator '+' cannot be applied to types 'null' and 'void'.
|
||||
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(19,10): error TS2365: Operator '+' cannot be applied to types 'null' and 'Number'.
|
||||
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(20,10): error TS2365: Operator '+' cannot be applied to types 'null' and 'true'.
|
||||
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(20,10): error TS2365: Operator '+' cannot be applied to types 'null' and 'boolean'.
|
||||
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(21,10): error TS2365: Operator '+' cannot be applied to types 'null' and '{ a: string; }'.
|
||||
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(22,11): error TS2365: Operator '+' cannot be applied to types 'null' and 'void'.
|
||||
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(23,11): error TS2365: Operator '+' cannot be applied to types 'null' and '() => void'.
|
||||
@@ -47,7 +47,7 @@ tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOpe
|
||||
!!! error TS2365: Operator '+' cannot be applied to types 'null' and 'Number'.
|
||||
var r8 = null + true;
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '+' cannot be applied to types 'null' and 'true'.
|
||||
!!! error TS2365: Operator '+' cannot be applied to types 'null' and 'boolean'.
|
||||
var r9 = null + { a: '' };
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '+' cannot be applied to types 'null' and '{ a: string; }'.
|
||||
|
||||
@@ -5,7 +5,7 @@ tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOpe
|
||||
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(15,10): error TS2365: Operator '+' cannot be applied to types 'Object' and 'undefined'.
|
||||
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(16,10): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'void'.
|
||||
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(19,10): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'Number'.
|
||||
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(20,10): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'true'.
|
||||
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(20,10): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'boolean'.
|
||||
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(21,10): error TS2365: Operator '+' cannot be applied to types 'undefined' and '{ a: string; }'.
|
||||
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(22,11): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'void'.
|
||||
tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(23,11): error TS2365: Operator '+' cannot be applied to types 'undefined' and '() => void'.
|
||||
@@ -47,7 +47,7 @@ tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOpe
|
||||
!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'Number'.
|
||||
var r8 = undefined + true;
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'true'.
|
||||
!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'boolean'.
|
||||
var r9 = undefined + { a: '' };
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and '{ a: string; }'.
|
||||
|
||||
@@ -1,29 +1,29 @@
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(6,1): error TS2365: Operator '+=' cannot be applied to types 'boolean' and 'void'.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(7,1): error TS2365: Operator '+=' cannot be applied to types 'boolean' and 'true'.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(8,1): error TS2365: Operator '+=' cannot be applied to types 'boolean' and '0'.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(9,1): error TS2365: Operator '+=' cannot be applied to types 'boolean' and 'E.a'.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(7,1): error TS2365: Operator '+=' cannot be applied to types 'boolean' and 'boolean'.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(8,1): error TS2365: Operator '+=' cannot be applied to types 'boolean' and 'number'.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(9,1): error TS2365: Operator '+=' cannot be applied to types 'boolean' and 'E'.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(10,1): error TS2365: Operator '+=' cannot be applied to types 'boolean' and '{}'.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(11,1): error TS2365: Operator '+=' cannot be applied to types 'boolean' and 'null'.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(12,1): error TS2365: Operator '+=' cannot be applied to types 'boolean' and 'undefined'.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(15,1): error TS2365: Operator '+=' cannot be applied to types '{}' and 'void'.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(16,1): error TS2365: Operator '+=' cannot be applied to types '{}' and 'true'.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(17,1): error TS2365: Operator '+=' cannot be applied to types '{}' and '0'.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(18,1): error TS2365: Operator '+=' cannot be applied to types '{}' and 'E.a'.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(16,1): error TS2365: Operator '+=' cannot be applied to types '{}' and 'boolean'.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(17,1): error TS2365: Operator '+=' cannot be applied to types '{}' and 'number'.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(18,1): error TS2365: Operator '+=' cannot be applied to types '{}' and 'E'.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(19,1): error TS2365: Operator '+=' cannot be applied to types '{}' and '{}'.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(20,1): error TS2365: Operator '+=' cannot be applied to types '{}' and 'null'.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(21,1): error TS2365: Operator '+=' cannot be applied to types '{}' and 'undefined'.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(24,1): error TS2365: Operator '+=' cannot be applied to types 'void' and 'void'.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(25,1): error TS2365: Operator '+=' cannot be applied to types 'void' and 'true'.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(26,1): error TS2365: Operator '+=' cannot be applied to types 'void' and '0'.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(27,1): error TS2365: Operator '+=' cannot be applied to types 'void' and 'E.a'.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(25,1): error TS2365: Operator '+=' cannot be applied to types 'void' and 'boolean'.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(26,1): error TS2365: Operator '+=' cannot be applied to types 'void' and 'number'.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(27,1): error TS2365: Operator '+=' cannot be applied to types 'void' and 'E'.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(28,1): error TS2365: Operator '+=' cannot be applied to types 'void' and '{}'.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(29,1): error TS2365: Operator '+=' cannot be applied to types 'void' and 'null'.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(30,1): error TS2365: Operator '+=' cannot be applied to types 'void' and 'undefined'.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(33,1): error TS2365: Operator '+=' cannot be applied to types 'number' and 'void'.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(34,1): error TS2365: Operator '+=' cannot be applied to types 'number' and 'true'.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(34,1): error TS2365: Operator '+=' cannot be applied to types 'number' and 'boolean'.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(35,1): error TS2365: Operator '+=' cannot be applied to types 'number' and '{}'.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(38,1): error TS2365: Operator '+=' cannot be applied to types 'E' and 'void'.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(39,1): error TS2365: Operator '+=' cannot be applied to types 'E' and 'true'.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(39,1): error TS2365: Operator '+=' cannot be applied to types 'E' and 'boolean'.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(40,1): error TS2365: Operator '+=' cannot be applied to types 'E' and '{}'.
|
||||
|
||||
|
||||
@@ -38,13 +38,13 @@ tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmen
|
||||
!!! error TS2365: Operator '+=' cannot be applied to types 'boolean' and 'void'.
|
||||
x1 += true;
|
||||
~~~~~~~~~~
|
||||
!!! error TS2365: Operator '+=' cannot be applied to types 'boolean' and 'true'.
|
||||
!!! error TS2365: Operator '+=' cannot be applied to types 'boolean' and 'boolean'.
|
||||
x1 += 0;
|
||||
~~~~~~~
|
||||
!!! error TS2365: Operator '+=' cannot be applied to types 'boolean' and '0'.
|
||||
!!! error TS2365: Operator '+=' cannot be applied to types 'boolean' and 'number'.
|
||||
x1 += E.a;
|
||||
~~~~~~~~~
|
||||
!!! error TS2365: Operator '+=' cannot be applied to types 'boolean' and 'E.a'.
|
||||
!!! error TS2365: Operator '+=' cannot be applied to types 'boolean' and 'E'.
|
||||
x1 += {};
|
||||
~~~~~~~~
|
||||
!!! error TS2365: Operator '+=' cannot be applied to types 'boolean' and '{}'.
|
||||
@@ -61,13 +61,13 @@ tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmen
|
||||
!!! error TS2365: Operator '+=' cannot be applied to types '{}' and 'void'.
|
||||
x2 += true;
|
||||
~~~~~~~~~~
|
||||
!!! error TS2365: Operator '+=' cannot be applied to types '{}' and 'true'.
|
||||
!!! error TS2365: Operator '+=' cannot be applied to types '{}' and 'boolean'.
|
||||
x2 += 0;
|
||||
~~~~~~~
|
||||
!!! error TS2365: Operator '+=' cannot be applied to types '{}' and '0'.
|
||||
!!! error TS2365: Operator '+=' cannot be applied to types '{}' and 'number'.
|
||||
x2 += E.a;
|
||||
~~~~~~~~~
|
||||
!!! error TS2365: Operator '+=' cannot be applied to types '{}' and 'E.a'.
|
||||
!!! error TS2365: Operator '+=' cannot be applied to types '{}' and 'E'.
|
||||
x2 += {};
|
||||
~~~~~~~~
|
||||
!!! error TS2365: Operator '+=' cannot be applied to types '{}' and '{}'.
|
||||
@@ -84,13 +84,13 @@ tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmen
|
||||
!!! error TS2365: Operator '+=' cannot be applied to types 'void' and 'void'.
|
||||
x3 += true;
|
||||
~~~~~~~~~~
|
||||
!!! error TS2365: Operator '+=' cannot be applied to types 'void' and 'true'.
|
||||
!!! error TS2365: Operator '+=' cannot be applied to types 'void' and 'boolean'.
|
||||
x3 += 0;
|
||||
~~~~~~~
|
||||
!!! error TS2365: Operator '+=' cannot be applied to types 'void' and '0'.
|
||||
!!! error TS2365: Operator '+=' cannot be applied to types 'void' and 'number'.
|
||||
x3 += E.a;
|
||||
~~~~~~~~~
|
||||
!!! error TS2365: Operator '+=' cannot be applied to types 'void' and 'E.a'.
|
||||
!!! error TS2365: Operator '+=' cannot be applied to types 'void' and 'E'.
|
||||
x3 += {};
|
||||
~~~~~~~~
|
||||
!!! error TS2365: Operator '+=' cannot be applied to types 'void' and '{}'.
|
||||
@@ -107,7 +107,7 @@ tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmen
|
||||
!!! error TS2365: Operator '+=' cannot be applied to types 'number' and 'void'.
|
||||
x4 += true;
|
||||
~~~~~~~~~~
|
||||
!!! error TS2365: Operator '+=' cannot be applied to types 'number' and 'true'.
|
||||
!!! error TS2365: Operator '+=' cannot be applied to types 'number' and 'boolean'.
|
||||
x4 += {};
|
||||
~~~~~~~~
|
||||
!!! error TS2365: Operator '+=' cannot be applied to types 'number' and '{}'.
|
||||
@@ -118,7 +118,7 @@ tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmen
|
||||
!!! error TS2365: Operator '+=' cannot be applied to types 'E' and 'void'.
|
||||
x5 += true;
|
||||
~~~~~~~~~~
|
||||
!!! error TS2365: Operator '+=' cannot be applied to types 'E' and 'true'.
|
||||
!!! error TS2365: Operator '+=' cannot be applied to types 'E' and 'boolean'.
|
||||
x5 += {};
|
||||
~~~~~~~~
|
||||
!!! error TS2365: Operator '+=' cannot be applied to types 'E' and '{}'.
|
||||
@@ -19,7 +19,7 @@ tests/cases/compiler/computedPropertiesInDestructuring1.ts(33,4): error TS2349:
|
||||
Type 'String' has no call signatures.
|
||||
tests/cases/compiler/computedPropertiesInDestructuring1.ts(33,4): error TS2538: Type 'any' cannot be used as an index type.
|
||||
tests/cases/compiler/computedPropertiesInDestructuring1.ts(34,4): error TS2538: Type 'any' cannot be used as an index type.
|
||||
tests/cases/compiler/computedPropertiesInDestructuring1.ts(34,5): error TS2365: Operator '+' cannot be applied to types '1' and '{}'.
|
||||
tests/cases/compiler/computedPropertiesInDestructuring1.ts(34,5): error TS2365: Operator '+' cannot be applied to types 'number' and '{}'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/computedPropertiesInDestructuring1.ts (20 errors) ====
|
||||
@@ -98,7 +98,7 @@ tests/cases/compiler/computedPropertiesInDestructuring1.ts(34,5): error TS2365:
|
||||
~~~~~~~~
|
||||
!!! error TS2538: Type 'any' cannot be used as an index type.
|
||||
~~~~~~
|
||||
!!! error TS2365: Operator '+' cannot be applied to types '1' and '{}'.
|
||||
!!! error TS2365: Operator '+' cannot be applied to types 'number' and '{}'.
|
||||
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(34,4): error TS23
|
||||
Type 'String' has no call signatures.
|
||||
tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(34,4): error TS2538: Type 'any' cannot be used as an index type.
|
||||
tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(35,4): error TS2538: Type 'any' cannot be used as an index type.
|
||||
tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(35,5): error TS2365: Operator '+' cannot be applied to types '1' and '{}'.
|
||||
tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(35,5): error TS2365: Operator '+' cannot be applied to types 'number' and '{}'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts (20 errors) ====
|
||||
@@ -99,5 +99,5 @@ tests/cases/compiler/computedPropertiesInDestructuring1_ES6.ts(35,5): error TS23
|
||||
~~~~~~~~
|
||||
!!! error TS2538: Type 'any' cannot be used as an index type.
|
||||
~~~~~~
|
||||
!!! error TS2365: Operator '+' cannot be applied to types '1' and '{}'.
|
||||
!!! error TS2365: Operator '+' cannot be applied to types 'number' and '{}'.
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
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 'false' 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 'false' 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(142,5): error TS2365: Operator '+' cannot be applied to types 'number' and 'false'.
|
||||
tests/cases/compiler/expr.ts(116,5): error TS2367: This condition will always return 'false' since the types 'E' and 'boolean' have no overlap.
|
||||
tests/cases/compiler/expr.ts(142,5): error TS2365: Operator '+' cannot be applied to types 'number' and 'boolean'.
|
||||
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'.
|
||||
tests/cases/compiler/expr.ts(163,5): error TS2365: Operator '+' cannot be applied to types 'I' and 'false'.
|
||||
tests/cases/compiler/expr.ts(163,5): error TS2365: Operator '+' cannot be applied to types 'I' and 'boolean'.
|
||||
tests/cases/compiler/expr.ts(165,5): error TS2365: Operator '+' cannot be applied to types 'I' and 'I'.
|
||||
tests/cases/compiler/expr.ts(166,5): error TS2365: Operator '+' cannot be applied to types 'I' and 'E'.
|
||||
tests/cases/compiler/expr.ts(170,5): error TS2365: Operator '+' cannot be applied to types 'E' and 'false'.
|
||||
tests/cases/compiler/expr.ts(170,5): error TS2365: Operator '+' cannot be applied to types 'E' and 'boolean'.
|
||||
tests/cases/compiler/expr.ts(172,5): error TS2365: Operator '+' cannot be applied to types 'E' and 'I'.
|
||||
tests/cases/compiler/expr.ts(176,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
|
||||
tests/cases/compiler/expr.ts(177,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
|
||||
@@ -161,7 +161,7 @@ tests/cases/compiler/expr.ts(242,7): error TS2363: The right-hand side of an ari
|
||||
!!! error TS2367: This condition will always return 'false' since the types 'number' and 'string' have no overlap.
|
||||
n==b;
|
||||
~~~~
|
||||
!!! error TS2367: This condition will always return 'false' since the types 'number' and 'false' have no overlap.
|
||||
!!! error TS2367: This condition will always return 'false' since the types 'number' and 'boolean' have no overlap.
|
||||
n==i;
|
||||
n==n;
|
||||
n==e;
|
||||
@@ -172,7 +172,7 @@ tests/cases/compiler/expr.ts(242,7): error TS2363: The right-hand side of an ari
|
||||
!!! error TS2367: This condition will always return 'false' since the types 'string' and 'number' have no overlap.
|
||||
s==b;
|
||||
~~~~
|
||||
!!! error TS2367: This condition will always return 'false' since the types 'string' and 'false' have no overlap.
|
||||
!!! error TS2367: This condition will always return 'false' since the types 'string' and 'boolean' have no overlap.
|
||||
s==i;
|
||||
s==s;
|
||||
s==e;
|
||||
@@ -199,7 +199,7 @@ tests/cases/compiler/expr.ts(242,7): error TS2363: The right-hand side of an ari
|
||||
!!! error TS2367: This condition will always return 'false' since the types 'E' and 'string' have no overlap.
|
||||
e==b;
|
||||
~~~~
|
||||
!!! error TS2367: This condition will always return 'false' since the types 'E' and 'false' have no overlap.
|
||||
!!! error TS2367: This condition will always return 'false' since the types 'E' and 'boolean' have no overlap.
|
||||
e==a;
|
||||
e==i;
|
||||
e==e;
|
||||
@@ -227,7 +227,7 @@ tests/cases/compiler/expr.ts(242,7): error TS2363: The right-hand side of an ari
|
||||
n+s;
|
||||
n+b;
|
||||
~~~
|
||||
!!! error TS2365: Operator '+' cannot be applied to types 'number' and 'false'.
|
||||
!!! error TS2365: Operator '+' cannot be applied to types 'number' and 'boolean'.
|
||||
n+i;
|
||||
~~~
|
||||
!!! error TS2365: Operator '+' cannot be applied to types 'number' and 'I'.
|
||||
@@ -254,7 +254,7 @@ tests/cases/compiler/expr.ts(242,7): error TS2363: The right-hand side of an ari
|
||||
i+s;
|
||||
i+b;
|
||||
~~~
|
||||
!!! error TS2365: Operator '+' cannot be applied to types 'I' and 'false'.
|
||||
!!! error TS2365: Operator '+' cannot be applied to types 'I' and 'boolean'.
|
||||
i+a;
|
||||
i+i;
|
||||
~~~
|
||||
@@ -267,7 +267,7 @@ tests/cases/compiler/expr.ts(242,7): error TS2363: The right-hand side of an ari
|
||||
e+s;
|
||||
e+b;
|
||||
~~~
|
||||
!!! error TS2365: Operator '+' cannot be applied to types 'E' and 'false'.
|
||||
!!! error TS2365: Operator '+' cannot be applied to types 'E' and 'boolean'.
|
||||
e+a;
|
||||
e+i;
|
||||
~~~
|
||||
|
||||
@@ -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 '1' have no overlap.
|
||||
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(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 '1' have no overlap.
|
||||
!!! error TS2367: This condition will always return 'false' since the types 'string' and 'number' have no overlap.
|
||||
}
|
||||
let a3 = x.unknownProperty;
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -2,48 +2,48 @@ tests/cases/compiler/numberVsBigIntOperations.ts(3,14): error TS2322: Type '2' i
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(3,26): error TS2322: Type '1n' is not assignable to type 'number'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(4,15): error TS2365: Operator '+=' cannot be applied to types 'bigint' and '2'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(4,28): error TS2365: Operator '+=' cannot be applied to types 'number' and '1n'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(5,15): error TS2365: Operator '-=' cannot be applied to types 'bigint' and '2'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(5,28): error TS2365: Operator '-=' cannot be applied to types 'number' and '1n'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(6,15): error TS2365: Operator '*=' cannot be applied to types 'bigint' and '2'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(6,28): error TS2365: Operator '*=' cannot be applied to types 'number' and '1n'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(7,15): error TS2365: Operator '/=' cannot be applied to types 'bigint' and '2'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(7,28): error TS2365: Operator '/=' cannot be applied to types 'number' and '1n'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(8,15): error TS2365: Operator '%=' cannot be applied to types 'bigint' and '2'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(8,28): error TS2365: Operator '%=' cannot be applied to types 'number' and '1n'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(9,16): error TS2365: Operator '**=' cannot be applied to types 'bigint' and '2'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(9,30): error TS2365: Operator '**=' cannot be applied to types 'number' and '1n'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(10,16): error TS2365: Operator '<<=' cannot be applied to types 'bigint' and '2'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(10,30): error TS2365: Operator '<<=' cannot be applied to types 'number' and '1n'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(11,16): error TS2365: Operator '>>=' cannot be applied to types 'bigint' and '2'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(11,30): error TS2365: Operator '>>=' cannot be applied to types 'number' and '1n'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(12,15): error TS2365: Operator '&=' cannot be applied to types 'bigint' and '2'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(12,28): error TS2365: Operator '&=' cannot be applied to types 'number' and '1n'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(13,15): error TS2365: Operator '^=' cannot be applied to types 'bigint' and '2'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(13,28): error TS2365: Operator '^=' cannot be applied to types 'number' and '1n'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(14,15): error TS2365: Operator '|=' cannot be applied to types 'bigint' and '2'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(14,28): error TS2365: Operator '|=' cannot be applied to types 'number' and '1n'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(5,15): error TS2365: Operator '-=' cannot be applied to types 'bigint' and 'number'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(5,28): error TS2365: Operator '-=' cannot be applied to types 'number' and 'bigint'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(6,15): error TS2365: Operator '*=' cannot be applied to types 'bigint' and 'number'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(6,28): error TS2365: Operator '*=' cannot be applied to types 'number' and 'bigint'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(7,15): error TS2365: Operator '/=' cannot be applied to types 'bigint' and 'number'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(7,28): error TS2365: Operator '/=' cannot be applied to types 'number' and 'bigint'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(8,15): error TS2365: Operator '%=' cannot be applied to types 'bigint' and 'number'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(8,28): error TS2365: Operator '%=' cannot be applied to types 'number' and 'bigint'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(9,16): error TS2365: Operator '**=' cannot be applied to types 'bigint' and 'number'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(9,30): error TS2365: Operator '**=' cannot be applied to types 'number' and 'bigint'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(10,16): error TS2365: Operator '<<=' cannot be applied to types 'bigint' and 'number'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(10,30): error TS2365: Operator '<<=' cannot be applied to types 'number' and 'bigint'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(11,16): error TS2365: Operator '>>=' cannot be applied to types 'bigint' and 'number'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(11,30): error TS2365: Operator '>>=' cannot be applied to types 'number' and 'bigint'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(12,15): error TS2365: Operator '&=' cannot be applied to types 'bigint' and 'number'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(12,28): error TS2365: Operator '&=' cannot be applied to types 'number' and 'bigint'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(13,15): error TS2365: Operator '^=' cannot be applied to types 'bigint' and 'number'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(13,28): error TS2365: Operator '^=' cannot be applied to types 'number' and 'bigint'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(14,15): error TS2365: Operator '|=' cannot be applied to types 'bigint' and 'number'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(14,28): error TS2365: Operator '|=' cannot be applied to types 'number' and 'bigint'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(15,32): error TS2365: Operator '+' cannot be applied to types '1' and '2n'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(15,40): error TS2365: Operator '+' cannot be applied to types '1n' and '2'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(16,32): error TS2365: Operator '-' cannot be applied to types '1' and '2n'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(16,40): error TS2365: Operator '-' cannot be applied to types '1n' and '2'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(17,32): error TS2365: Operator '*' cannot be applied to types '1' and '2n'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(17,40): error TS2365: Operator '*' cannot be applied to types '1n' and '2'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(18,32): error TS2365: Operator '/' cannot be applied to types '1' and '2n'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(18,40): error TS2365: Operator '/' cannot be applied to types '1n' and '2'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(19,32): error TS2365: Operator '%' cannot be applied to types '1' and '2n'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(19,40): error TS2365: Operator '%' cannot be applied to types '1n' and '2'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(20,34): error TS2365: Operator '**' cannot be applied to types '1' and '2n'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(20,43): error TS2365: Operator '**' cannot be applied to types '1n' and '2'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(21,32): error TS2365: Operator '&' cannot be applied to types '1' and '2n'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(21,40): error TS2365: Operator '&' cannot be applied to types '1n' and '2'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(22,32): error TS2365: Operator '|' cannot be applied to types '1' and '2n'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(22,40): error TS2365: Operator '|' cannot be applied to types '1n' and '2'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(23,32): error TS2365: Operator '^' cannot be applied to types '1' and '2n'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(23,40): error TS2365: Operator '^' cannot be applied to types '1n' and '2'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(24,34): error TS2365: Operator '<<' cannot be applied to types '1' and '2n'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(24,43): error TS2365: Operator '<<' cannot be applied to types '1n' and '2'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(25,34): error TS2365: Operator '>>' cannot be applied to types '1' and '2n'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(25,43): error TS2365: Operator '>>' cannot be applied to types '1n' and '2'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(16,32): error TS2365: Operator '-' cannot be applied to types 'number' and 'bigint'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(16,40): error TS2365: Operator '-' cannot be applied to types 'bigint' and 'number'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(17,32): error TS2365: Operator '*' cannot be applied to types 'number' and 'bigint'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(17,40): error TS2365: Operator '*' cannot be applied to types 'bigint' and 'number'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(18,32): error TS2365: Operator '/' cannot be applied to types 'number' and 'bigint'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(18,40): error TS2365: Operator '/' cannot be applied to types 'bigint' and 'number'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(19,32): error TS2365: Operator '%' cannot be applied to types 'number' and 'bigint'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(19,40): error TS2365: Operator '%' cannot be applied to types 'bigint' and 'number'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(20,34): error TS2365: Operator '**' cannot be applied to types 'number' and 'bigint'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(20,43): error TS2365: Operator '**' cannot be applied to types 'bigint' and 'number'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(21,32): error TS2365: Operator '&' cannot be applied to types 'number' and 'bigint'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(21,40): error TS2365: Operator '&' cannot be applied to types 'bigint' and 'number'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(22,32): error TS2365: Operator '|' cannot be applied to types 'number' and 'bigint'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(22,40): error TS2365: Operator '|' cannot be applied to types 'bigint' and 'number'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(23,32): error TS2365: Operator '^' cannot be applied to types 'number' and 'bigint'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(23,40): error TS2365: Operator '^' cannot be applied to types 'bigint' and 'number'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(24,34): error TS2365: Operator '<<' cannot be applied to types 'number' and 'bigint'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(24,43): error TS2365: Operator '<<' cannot be applied to types 'bigint' and 'number'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(25,34): error TS2365: Operator '>>' cannot be applied to types 'number' and 'bigint'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(25,43): error TS2365: Operator '>>' cannot be applied to types 'bigint' and 'number'.
|
||||
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'.
|
||||
@@ -54,8 +54,8 @@ tests/cases/compiler/numberVsBigIntOperations.ts(53,10): error TS2367: This cond
|
||||
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.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(57,1): error TS2365: Operator '&' cannot be applied to types '"3"' and '5n'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(57,11): error TS2365: Operator '**' cannot be applied to types '2n' and 'false'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(57,1): error TS2365: Operator '&' cannot be applied to types 'string' and 'bigint'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(57,11): error TS2365: Operator '**' cannot be applied to types 'bigint' and 'boolean'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(57,17): 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(60,1): error TS2365: Operator '+' cannot be applied to types 'number | bigint' and 'number | bigint'.
|
||||
tests/cases/compiler/numberVsBigIntOperations.ts(61,1): error TS2365: Operator '<<' cannot be applied to types 'number | bigint' and 'number | bigint'.
|
||||
@@ -79,54 +79,54 @@ tests/cases/compiler/numberVsBigIntOperations.ts(93,7): error TS1155: 'const' de
|
||||
!!! error TS2365: Operator '+=' cannot be applied to types 'number' and '1n'.
|
||||
bigInt -= 1n; bigInt -= 2; num -= 1n; num -= 2;
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '-=' cannot be applied to types 'bigint' and '2'.
|
||||
!!! error TS2365: Operator '-=' cannot be applied to types 'bigint' and 'number'.
|
||||
~~~~~~~~~
|
||||
!!! error TS2365: Operator '-=' cannot be applied to types 'number' and '1n'.
|
||||
!!! error TS2365: Operator '-=' cannot be applied to types 'number' and 'bigint'.
|
||||
bigInt *= 1n; bigInt *= 2; num *= 1n; num *= 2;
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '*=' cannot be applied to types 'bigint' and '2'.
|
||||
!!! error TS2365: Operator '*=' cannot be applied to types 'bigint' and 'number'.
|
||||
~~~~~~~~~
|
||||
!!! error TS2365: Operator '*=' cannot be applied to types 'number' and '1n'.
|
||||
!!! error TS2365: Operator '*=' cannot be applied to types 'number' and 'bigint'.
|
||||
bigInt /= 1n; bigInt /= 2; num /= 1n; num /= 2;
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '/=' cannot be applied to types 'bigint' and '2'.
|
||||
!!! error TS2365: Operator '/=' cannot be applied to types 'bigint' and 'number'.
|
||||
~~~~~~~~~
|
||||
!!! error TS2365: Operator '/=' cannot be applied to types 'number' and '1n'.
|
||||
!!! error TS2365: Operator '/=' cannot be applied to types 'number' and 'bigint'.
|
||||
bigInt %= 1n; bigInt %= 2; num %= 1n; num %= 2;
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '%=' cannot be applied to types 'bigint' and '2'.
|
||||
!!! error TS2365: Operator '%=' cannot be applied to types 'bigint' and 'number'.
|
||||
~~~~~~~~~
|
||||
!!! error TS2365: Operator '%=' cannot be applied to types 'number' and '1n'.
|
||||
!!! error TS2365: Operator '%=' cannot be applied to types 'number' and 'bigint'.
|
||||
bigInt **= 1n; bigInt **= 2; num **= 1n; num **= 2;
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '**=' cannot be applied to types 'bigint' and '2'.
|
||||
!!! error TS2365: Operator '**=' cannot be applied to types 'bigint' and 'number'.
|
||||
~~~~~~~~~~
|
||||
!!! error TS2365: Operator '**=' cannot be applied to types 'number' and '1n'.
|
||||
!!! error TS2365: Operator '**=' cannot be applied to types 'number' and 'bigint'.
|
||||
bigInt <<= 1n; bigInt <<= 2; num <<= 1n; num <<= 2;
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '<<=' cannot be applied to types 'bigint' and '2'.
|
||||
!!! error TS2365: Operator '<<=' cannot be applied to types 'bigint' and 'number'.
|
||||
~~~~~~~~~~
|
||||
!!! error TS2365: Operator '<<=' cannot be applied to types 'number' and '1n'.
|
||||
!!! error TS2365: Operator '<<=' cannot be applied to types 'number' and 'bigint'.
|
||||
bigInt >>= 1n; bigInt >>= 2; num >>= 1n; num >>= 2;
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '>>=' cannot be applied to types 'bigint' and '2'.
|
||||
!!! error TS2365: Operator '>>=' cannot be applied to types 'bigint' and 'number'.
|
||||
~~~~~~~~~~
|
||||
!!! error TS2365: Operator '>>=' cannot be applied to types 'number' and '1n'.
|
||||
!!! error TS2365: Operator '>>=' cannot be applied to types 'number' and 'bigint'.
|
||||
bigInt &= 1n; bigInt &= 2; num &= 1n; num &= 2;
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '&=' cannot be applied to types 'bigint' and '2'.
|
||||
!!! error TS2365: Operator '&=' cannot be applied to types 'bigint' and 'number'.
|
||||
~~~~~~~~~
|
||||
!!! error TS2365: Operator '&=' cannot be applied to types 'number' and '1n'.
|
||||
!!! error TS2365: Operator '&=' cannot be applied to types 'number' and 'bigint'.
|
||||
bigInt ^= 1n; bigInt ^= 2; num ^= 1n; num ^= 2;
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '^=' cannot be applied to types 'bigint' and '2'.
|
||||
!!! error TS2365: Operator '^=' cannot be applied to types 'bigint' and 'number'.
|
||||
~~~~~~~~~
|
||||
!!! error TS2365: Operator '^=' cannot be applied to types 'number' and '1n'.
|
||||
!!! error TS2365: Operator '^=' cannot be applied to types 'number' and 'bigint'.
|
||||
bigInt |= 1n; bigInt |= 2; num |= 1n; num |= 2;
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '|=' cannot be applied to types 'bigint' and '2'.
|
||||
!!! error TS2365: Operator '|=' cannot be applied to types 'bigint' and 'number'.
|
||||
~~~~~~~~~
|
||||
!!! error TS2365: Operator '|=' cannot be applied to types 'number' and '1n'.
|
||||
!!! error TS2365: Operator '|=' cannot be applied to types 'number' and 'bigint'.
|
||||
bigInt = 1n + 2n; num = 1 + 2; 1 + 2n; 1n + 2;
|
||||
~~~~~~
|
||||
!!! error TS2365: Operator '+' cannot be applied to types '1' and '2n'.
|
||||
@@ -134,54 +134,54 @@ tests/cases/compiler/numberVsBigIntOperations.ts(93,7): error TS1155: 'const' de
|
||||
!!! error TS2365: Operator '+' cannot be applied to types '1n' and '2'.
|
||||
bigInt = 1n - 2n; num = 1 - 2; 1 - 2n; 1n - 2;
|
||||
~~~~~~
|
||||
!!! error TS2365: Operator '-' cannot be applied to types '1' and '2n'.
|
||||
!!! error TS2365: Operator '-' cannot be applied to types 'number' and 'bigint'.
|
||||
~~~~~~
|
||||
!!! error TS2365: Operator '-' cannot be applied to types '1n' and '2'.
|
||||
!!! error TS2365: Operator '-' cannot be applied to types 'bigint' and 'number'.
|
||||
bigInt = 1n * 2n; num = 1 * 2; 1 * 2n; 1n * 2;
|
||||
~~~~~~
|
||||
!!! error TS2365: Operator '*' cannot be applied to types '1' and '2n'.
|
||||
!!! error TS2365: Operator '*' cannot be applied to types 'number' and 'bigint'.
|
||||
~~~~~~
|
||||
!!! error TS2365: Operator '*' cannot be applied to types '1n' and '2'.
|
||||
!!! error TS2365: Operator '*' cannot be applied to types 'bigint' and 'number'.
|
||||
bigInt = 1n / 2n; num = 1 / 2; 1 / 2n; 1n / 2;
|
||||
~~~~~~
|
||||
!!! error TS2365: Operator '/' cannot be applied to types '1' and '2n'.
|
||||
!!! error TS2365: Operator '/' cannot be applied to types 'number' and 'bigint'.
|
||||
~~~~~~
|
||||
!!! error TS2365: Operator '/' cannot be applied to types '1n' and '2'.
|
||||
!!! error TS2365: Operator '/' cannot be applied to types 'bigint' and 'number'.
|
||||
bigInt = 1n % 2n; num = 1 % 2; 1 % 2n; 1n % 2;
|
||||
~~~~~~
|
||||
!!! error TS2365: Operator '%' cannot be applied to types '1' and '2n'.
|
||||
!!! error TS2365: Operator '%' cannot be applied to types 'number' and 'bigint'.
|
||||
~~~~~~
|
||||
!!! error TS2365: Operator '%' cannot be applied to types '1n' and '2'.
|
||||
!!! error TS2365: Operator '%' cannot be applied to types 'bigint' and 'number'.
|
||||
bigInt = 1n ** 2n; num = 1 ** 2; 1 ** 2n; 1n ** 2;
|
||||
~~~~~~~
|
||||
!!! error TS2365: Operator '**' cannot be applied to types '1' and '2n'.
|
||||
!!! error TS2365: Operator '**' cannot be applied to types 'number' and 'bigint'.
|
||||
~~~~~~~
|
||||
!!! error TS2365: Operator '**' cannot be applied to types '1n' and '2'.
|
||||
!!! error TS2365: Operator '**' cannot be applied to types 'bigint' and 'number'.
|
||||
bigInt = 1n & 2n; num = 1 & 2; 1 & 2n; 1n & 2;
|
||||
~~~~~~
|
||||
!!! error TS2365: Operator '&' cannot be applied to types '1' and '2n'.
|
||||
!!! error TS2365: Operator '&' cannot be applied to types 'number' and 'bigint'.
|
||||
~~~~~~
|
||||
!!! error TS2365: Operator '&' cannot be applied to types '1n' and '2'.
|
||||
!!! error TS2365: Operator '&' cannot be applied to types 'bigint' and 'number'.
|
||||
bigInt = 1n | 2n; num = 1 | 2; 1 | 2n; 1n | 2;
|
||||
~~~~~~
|
||||
!!! error TS2365: Operator '|' cannot be applied to types '1' and '2n'.
|
||||
!!! error TS2365: Operator '|' cannot be applied to types 'number' and 'bigint'.
|
||||
~~~~~~
|
||||
!!! error TS2365: Operator '|' cannot be applied to types '1n' and '2'.
|
||||
!!! error TS2365: Operator '|' cannot be applied to types 'bigint' and 'number'.
|
||||
bigInt = 1n ^ 2n; num = 1 ^ 2; 1 ^ 2n; 1n ^ 2;
|
||||
~~~~~~
|
||||
!!! error TS2365: Operator '^' cannot be applied to types '1' and '2n'.
|
||||
!!! error TS2365: Operator '^' cannot be applied to types 'number' and 'bigint'.
|
||||
~~~~~~
|
||||
!!! error TS2365: Operator '^' cannot be applied to types '1n' and '2'.
|
||||
!!! error TS2365: Operator '^' cannot be applied to types 'bigint' and 'number'.
|
||||
bigInt = 1n << 2n; num = 1 << 2; 1 << 2n; 1n << 2;
|
||||
~~~~~~~
|
||||
!!! error TS2365: Operator '<<' cannot be applied to types '1' and '2n'.
|
||||
!!! error TS2365: Operator '<<' cannot be applied to types 'number' and 'bigint'.
|
||||
~~~~~~~
|
||||
!!! error TS2365: Operator '<<' cannot be applied to types '1n' and '2'.
|
||||
!!! error TS2365: Operator '<<' cannot be applied to types 'bigint' and 'number'.
|
||||
bigInt = 1n >> 2n; num = 1 >> 2; 1 >> 2n; 1n >> 2;
|
||||
~~~~~~~
|
||||
!!! error TS2365: Operator '>>' cannot be applied to types '1' and '2n'.
|
||||
!!! error TS2365: Operator '>>' cannot be applied to types 'number' and 'bigint'.
|
||||
~~~~~~~
|
||||
!!! error TS2365: Operator '>>' cannot be applied to types '1n' and '2'.
|
||||
!!! error TS2365: Operator '>>' cannot be applied to types 'bigint' and 'number'.
|
||||
|
||||
// Plus should still coerce to strings
|
||||
let str: string;
|
||||
@@ -235,9 +235,9 @@ tests/cases/compiler/numberVsBigIntOperations.ts(93,7): error TS1155: 'const' de
|
||||
~~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
|
||||
~~~~~~~~
|
||||
!!! error TS2365: Operator '&' cannot be applied to types '"3"' and '5n'.
|
||||
!!! error TS2365: Operator '&' cannot be applied to types 'string' and 'bigint'.
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '**' cannot be applied to types '2n' and 'false'.
|
||||
!!! error TS2365: Operator '**' cannot be applied to types 'bigint' and 'boolean'.
|
||||
~~~~~
|
||||
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
|
||||
num = ~"3"; num = -false; // should infer number
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/parseBigInt.ts(51,20): error TS2736: Operator '+' cannot be applied to type '123n'.
|
||||
tests/cases/compiler/parseBigInt.ts(52,23): error TS2736: Operator '+' cannot be applied to type '291n'.
|
||||
tests/cases/compiler/parseBigInt.ts(51,20): error TS2736: Operator '+' cannot be applied to type 'bigint'.
|
||||
tests/cases/compiler/parseBigInt.ts(52,23): error TS2736: Operator '+' cannot be applied to type 'bigint'.
|
||||
tests/cases/compiler/parseBigInt.ts(56,25): error TS1005: ',' expected.
|
||||
tests/cases/compiler/parseBigInt.ts(57,22): error TS1352: A bigint literal cannot use exponential notation.
|
||||
tests/cases/compiler/parseBigInt.ts(58,19): error TS1353: A bigint literal must be an integer.
|
||||
@@ -70,10 +70,10 @@ tests/cases/compiler/parseBigInt.ts(70,72): error TS2345: Argument of type '3' i
|
||||
// Plus not allowed on literals
|
||||
const unaryPlus = +123n;
|
||||
~~~~
|
||||
!!! error TS2736: Operator '+' cannot be applied to type '123n'.
|
||||
!!! error TS2736: Operator '+' cannot be applied to type 'bigint'.
|
||||
const unaryPlusHex = +0x123n;
|
||||
~~~~~~
|
||||
!!! error TS2736: Operator '+' cannot be applied to type '291n'.
|
||||
!!! error TS2736: Operator '+' cannot be applied to type 'bigint'.
|
||||
|
||||
// Parsing errors
|
||||
// In separate blocks because they each declare an "n" variable
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(6,9): error TS2365: Operator '+' cannot be applied to types 'number | "ABC" | "XYZ"' and '100'.
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(7,9): error TS2365: Operator '+' cannot be applied to types '100' and 'number | "ABC" | "XYZ"'.
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(8,9): error TS2365: Operator '+' cannot be applied to types 'number | "ABC" | "XYZ"' and 'number | "ABC" | "XYZ"'.
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(9,9): error TS2365: Operator '+' cannot be applied to types 'number | "ABC" | "XYZ"' and 'true'.
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(10,9): error TS2365: Operator '+' cannot be applied to types 'false' and 'number | "ABC" | "XYZ"'.
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(6,9): error TS2365: Operator '+' cannot be applied to types 'string | number' and 'number'.
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(7,9): error TS2365: Operator '+' cannot be applied to types 'number' and 'string | number'.
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(8,9): error TS2365: Operator '+' cannot be applied to types 'string | number' and 'string | number'.
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(9,9): error TS2365: Operator '+' cannot be applied to types 'string | number' and 'boolean'.
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(10,9): error TS2365: Operator '+' cannot be applied to types 'boolean' and 'string | number'.
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(11,9): error TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type.
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(12,11): error TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type.
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(13,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
|
||||
@@ -19,19 +19,19 @@ tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperato
|
||||
|
||||
let a = abcOrXyzOrNumber + 100;
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '+' cannot be applied to types 'number | "ABC" | "XYZ"' and '100'.
|
||||
!!! error TS2365: Operator '+' cannot be applied to types 'string | number' and 'number'.
|
||||
let b = 100 + abcOrXyzOrNumber;
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '+' cannot be applied to types '100' and 'number | "ABC" | "XYZ"'.
|
||||
!!! error TS2365: Operator '+' cannot be applied to types 'number' and 'string | number'.
|
||||
let c = abcOrXyzOrNumber + abcOrXyzOrNumber;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '+' cannot be applied to types 'number | "ABC" | "XYZ"' and 'number | "ABC" | "XYZ"'.
|
||||
!!! error TS2365: Operator '+' cannot be applied to types 'string | number' and 'string | number'.
|
||||
let d = abcOrXyzOrNumber + true;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '+' cannot be applied to types 'number | "ABC" | "XYZ"' and 'true'.
|
||||
!!! error TS2365: Operator '+' cannot be applied to types 'string | number' and 'boolean'.
|
||||
let e = false + abcOrXyzOrNumber;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2365: Operator '+' cannot be applied to types 'false' and 'number | "ABC" | "XYZ"'.
|
||||
!!! error TS2365: Operator '+' cannot be applied to types 'boolean' and 'string | number'.
|
||||
let f = abcOrXyzOrNumber++;
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! error TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type.
|
||||
|
||||
@@ -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 '"foo"' and 'number' 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,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 '"foo"' and 'number' have no overlap.
|
||||
!!! error TS2367: This condition will always return 'false' since the types 'string' and 'number' have no overlap.
|
||||
~~~~~~~~~~~~~
|
||||
!!! 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);
|
||||
@@ -8,7 +8,7 @@ tests/cases/conformance/es6/Symbols/symbolType12.ts(7,1): error TS2362: The left
|
||||
tests/cases/conformance/es6/Symbols/symbolType12.ts(7,6): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
|
||||
tests/cases/conformance/es6/Symbols/symbolType12.ts(8,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
|
||||
tests/cases/conformance/es6/Symbols/symbolType12.ts(9,1): error TS2365: Operator '+=' cannot be applied to types 'symbol' and 'symbol'.
|
||||
tests/cases/conformance/es6/Symbols/symbolType12.ts(10,1): error TS2365: Operator '+=' cannot be applied to types 'symbol' and '0'.
|
||||
tests/cases/conformance/es6/Symbols/symbolType12.ts(10,1): error TS2365: Operator '+=' cannot be applied to types 'symbol' and 'number'.
|
||||
tests/cases/conformance/es6/Symbols/symbolType12.ts(11,1): error TS2469: The '+=' operator cannot be applied to type 'symbol'.
|
||||
tests/cases/conformance/es6/Symbols/symbolType12.ts(12,8): error TS2469: The '+=' operator cannot be applied to type 'symbol'.
|
||||
tests/cases/conformance/es6/Symbols/symbolType12.ts(13,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
|
||||
@@ -67,7 +67,7 @@ tests/cases/conformance/es6/Symbols/symbolType12.ts(28,8): error TS2469: The '+=
|
||||
!!! error TS2365: Operator '+=' cannot be applied to types 'symbol' and 'symbol'.
|
||||
s += 0;
|
||||
~~~~~~
|
||||
!!! error TS2365: Operator '+=' cannot be applied to types 'symbol' and '0'.
|
||||
!!! error TS2365: Operator '+=' cannot be applied to types 'symbol' and 'number'.
|
||||
s += "";
|
||||
~
|
||||
!!! error TS2469: The '+=' operator cannot be applied to type 'symbol'.
|
||||
|
||||
@@ -3,10 +3,10 @@ tests/cases/conformance/es6/Symbols/symbolType6.ts(4,1): error TS2362: The left-
|
||||
tests/cases/conformance/es6/Symbols/symbolType6.ts(4,5): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
|
||||
tests/cases/conformance/es6/Symbols/symbolType6.ts(5,1): error TS2469: The '+' operator cannot be applied to type 'symbol'.
|
||||
tests/cases/conformance/es6/Symbols/symbolType6.ts(6,1): error TS2469: The '+' operator cannot be applied to type 'symbol'.
|
||||
tests/cases/conformance/es6/Symbols/symbolType6.ts(7,1): error TS2365: Operator '+' cannot be applied to types 'symbol' and '0'.
|
||||
tests/cases/conformance/es6/Symbols/symbolType6.ts(7,1): error TS2365: Operator '+' cannot be applied to types 'symbol' and 'number'.
|
||||
tests/cases/conformance/es6/Symbols/symbolType6.ts(8,6): error TS2469: The '+' operator cannot be applied to type 'symbol'.
|
||||
tests/cases/conformance/es6/Symbols/symbolType6.ts(9,5): error TS2469: The '+' operator cannot be applied to type 'symbol'.
|
||||
tests/cases/conformance/es6/Symbols/symbolType6.ts(10,1): error TS2365: Operator '+' cannot be applied to types '0' and 'symbol'.
|
||||
tests/cases/conformance/es6/Symbols/symbolType6.ts(10,1): error TS2365: Operator '+' cannot be applied to types 'number' and 'symbol'.
|
||||
tests/cases/conformance/es6/Symbols/symbolType6.ts(11,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
|
||||
tests/cases/conformance/es6/Symbols/symbolType6.ts(12,5): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
|
||||
tests/cases/conformance/es6/Symbols/symbolType6.ts(14,1): error TS2469: The '+' operator cannot be applied to type 'symbol'.
|
||||
@@ -32,7 +32,7 @@ tests/cases/conformance/es6/Symbols/symbolType6.ts(15,6): error TS2469: The '+'
|
||||
!!! error TS2469: The '+' operator cannot be applied to type 'symbol'.
|
||||
s + 0;
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '+' cannot be applied to types 'symbol' and '0'.
|
||||
!!! error TS2365: Operator '+' cannot be applied to types 'symbol' and 'number'.
|
||||
"" + s;
|
||||
~
|
||||
!!! error TS2469: The '+' operator cannot be applied to type 'symbol'.
|
||||
@@ -41,7 +41,7 @@ tests/cases/conformance/es6/Symbols/symbolType6.ts(15,6): error TS2469: The '+'
|
||||
!!! error TS2469: The '+' operator cannot be applied to type 'symbol'.
|
||||
0 + s;
|
||||
~~~~~
|
||||
!!! error TS2365: Operator '+' cannot be applied to types '0' and 'symbol'.
|
||||
!!! error TS2365: Operator '+' cannot be applied to types 'number' and 'symbol'.
|
||||
s - 0;
|
||||
~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
|
||||
|
||||
@@ -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 'true' have no overlap.
|
||||
tests/cases/conformance/es6/Symbols/symbolType9.ts(5,1): error TS2367: This condition will always return 'true' since the types '0' 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 '1' have no overlap.
|
||||
tests/cases/conformance/es6/Symbols/symbolType9.ts(9,1): error TS2367: This condition will always return 'true' since the types 'false' and 'symbol' have no overlap.
|
||||
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 (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 'true' have no overlap.
|
||||
!!! error TS2367: This condition will always return 'false' since the types 'symbol' and 'boolean' have no overlap.
|
||||
s != s;
|
||||
0 != s;
|
||||
~~~~~~
|
||||
!!! error TS2367: This condition will always return 'true' since the types '0' and 'symbol' have no overlap.
|
||||
!!! error TS2367: This condition will always return 'true' since the types 'number' and 'symbol' have no overlap.
|
||||
s === s;
|
||||
s === 1;
|
||||
~~~~~~~
|
||||
!!! error TS2367: This condition will always return 'false' since the types 'symbol' and '1' have no overlap.
|
||||
!!! error TS2367: This condition will always return 'false' since the types 'symbol' and 'number' have no overlap.
|
||||
s !== s;
|
||||
false !== s;
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2367: This condition will always return 'true' since the types 'false' and 'symbol' have no overlap.
|
||||
!!! error TS2367: This condition will always return 'true' since the types 'boolean' and 'symbol' have no overlap.
|
||||
Reference in New Issue
Block a user