TypeScript/tests/baselines/reference/commaOperatorInvalidAssignmentType.errors.txt
2014-09-11 16:11:08 -07:00

31 lines
1.2 KiB
Plaintext

==== tests/cases/conformance/expressions/commaOperator/commaOperatorInvalidAssignmentType.ts (6 errors) ====
var BOOLEAN: boolean;
var NUMBER: number;
var STRING: string;
var resultIsBoolean: boolean
var resultIsNumber: number
var resultIsString: string
//Expect errors when the results type is different form the second operand
resultIsBoolean = (BOOLEAN, STRING);
~~~~~~~~~~~~~~~
!!! error TS2323: Type 'string' is not assignable to type 'boolean'.
resultIsBoolean = (BOOLEAN, NUMBER);
~~~~~~~~~~~~~~~
!!! error TS2323: Type 'number' is not assignable to type 'boolean'.
resultIsNumber = (NUMBER, BOOLEAN);
~~~~~~~~~~~~~~
!!! error TS2323: Type 'boolean' is not assignable to type 'number'.
resultIsNumber = (NUMBER, STRING);
~~~~~~~~~~~~~~
!!! error TS2323: Type 'string' is not assignable to type 'number'.
resultIsString = (STRING, BOOLEAN);
~~~~~~~~~~~~~~
!!! error TS2323: Type 'boolean' is not assignable to type 'string'.
resultIsString = (STRING, NUMBER);
~~~~~~~~~~~~~~
!!! error TS2323: Type 'number' is not assignable to type 'string'.