43 lines
1.8 KiB
Plaintext
43 lines
1.8 KiB
Plaintext
==== tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumTypeInvalidOperations.ts (10 errors) ====
|
|
// -- operator on enum type
|
|
|
|
enum ENUM { };
|
|
enum ENUM1 { 1, 2, "" };
|
|
|
|
// enum type var
|
|
var ResultIsNumber1 = --ENUM;
|
|
~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
var ResultIsNumber2 = --ENUM1;
|
|
~~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
|
|
var ResultIsNumber3 = ENUM--;
|
|
~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
var ResultIsNumber4 = ENUM1--;
|
|
~~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
|
|
// enum type expressions
|
|
var ResultIsNumber5 = --(ENUM[1] + ENUM[2]);
|
|
~~~~~~~~~~~~~~~~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
var ResultIsNumber6 = (ENUM[1] + ENUM[2])--;
|
|
~~~~~~~~~~~~~~~~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
|
|
// miss assignment operator
|
|
--ENUM;
|
|
~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
--ENUM1;
|
|
~~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
|
|
ENUM--;
|
|
~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
ENUM1--;
|
|
~~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. |