TypeScript/tests/baselines/reference/decrementOperatorWithEnumType.errors.txt

27 lines
1.6 KiB
Text
Raw Normal View History

tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType.ts(6,25): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType.ts(7,23): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType.ts(10,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType.ts(12,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
==== tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType.ts (4 errors) ====
// -- operator on enum type
enum ENUM1 { A, B, "" };
// expression
var ResultIsNumber1 = --ENUM1[1];
~~~~~~~~
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
var ResultIsNumber2 = ENUM1[1]--;
~~~~~~~~
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
// miss assignment operator
--ENUM1[1];
~~~~~~~~
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
ENUM1[1]--;
~~~~~~~~
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.