185 lines
No EOL
14 KiB
Text
185 lines
No EOL
14 KiB
Text
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(18,25): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(19,25): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(21,23): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(22,23): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(25,25): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(26,25): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(27,25): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(29,23): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(30,23): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(31,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(34,26): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(35,26): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(36,26): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(37,26): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(38,26): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(39,26): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(41,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(42,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(43,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(44,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(45,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(46,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(49,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(50,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(51,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(52,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(53,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(54,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(55,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(56,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(58,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(59,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(60,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(61,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(62,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(63,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(64,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(65,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts(65,11): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
|
|
|
|
==== tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithUnsupportedStringType.ts (39 errors) ====
|
|
// ++ operator on string type
|
|
var STRING: string;
|
|
var STRING1: string[] = ["", ""];
|
|
|
|
function foo(): string { return ""; }
|
|
|
|
class A {
|
|
public a: string;
|
|
static foo() { return ""; }
|
|
}
|
|
module M {
|
|
export var n: string;
|
|
}
|
|
|
|
var objA = new A();
|
|
|
|
// string type var
|
|
var ResultIsNumber1 = ++STRING;
|
|
~~~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
var ResultIsNumber2 = ++STRING1;
|
|
~~~~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
|
|
var ResultIsNumber3 = STRING++;
|
|
~~~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
var ResultIsNumber4 = STRING1++;
|
|
~~~~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
|
|
// string type literal
|
|
var ResultIsNumber5 = ++"";
|
|
~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
var ResultIsNumber6 = ++{ x: "", y: "" };
|
|
~~~~~~~~~~~~~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
var ResultIsNumber7 = ++{ x: "", y: (s: string) => { return s; } };
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
|
|
var ResultIsNumber8 = ""++;
|
|
~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
var ResultIsNumber9 = { x: "", y: "" }++;
|
|
~~~~~~~~~~~~~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
var ResultIsNumber10 = { x: "", y: (s: string) => { return s; } }++;
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
|
|
// string type expressions
|
|
var ResultIsNumber11 = ++objA.a;
|
|
~~~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
var ResultIsNumber12 = ++M.n;
|
|
~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
var ResultIsNumber13 = ++STRING1[0];
|
|
~~~~~~~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
var ResultIsNumber14 = ++foo();
|
|
~~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
var ResultIsNumber15 = ++A.foo();
|
|
~~~~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
var ResultIsNumber16 = ++(STRING + STRING);
|
|
~~~~~~~~~~~~~~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
|
|
var ResultIsNumber17 = objA.a++;
|
|
~~~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
var ResultIsNumber18 = M.n++;
|
|
~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
var ResultIsNumber19 = STRING1[0]++;
|
|
~~~~~~~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
var ResultIsNumber20 = foo()++;
|
|
~~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
var ResultIsNumber21 = A.foo()++;
|
|
~~~~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
var ResultIsNumber22 = (STRING + STRING)++;
|
|
~~~~~~~~~~~~~~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
|
|
// miss assignment operators
|
|
++"";
|
|
~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
++STRING;
|
|
~~~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
++STRING1;
|
|
~~~~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
++STRING1[0];
|
|
~~~~~~~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
++foo();
|
|
~~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
++objA.a;
|
|
~~~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
++M.n;
|
|
~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
++objA.a, M.n;
|
|
~~~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
|
|
""++;
|
|
~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
STRING++;
|
|
~~~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
STRING1++;
|
|
~~~~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
STRING1[0]++;
|
|
~~~~~~~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
foo()++;
|
|
~~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
objA.a++;
|
|
~~~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
M.n++;
|
|
~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
objA.a++, M.n++;
|
|
~~~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. |