TypeScript/tests/baselines/reference/commaOperatorOtherInvalidOperation.errors.txt
Toan Nguyen 0c76803854
Fix typos in comments (#41307)
* Fix typo fuction -> function

* Fix typo assignement -> assignment
2020-11-30 15:02:07 -08:00

24 lines
1.1 KiB
Plaintext

tests/cases/conformance/expressions/commaOperator/commaOperatorOtherInvalidOperation.ts(6,5): error TS2322: Type 'string' is not assignable to type 'number'.
tests/cases/conformance/expressions/commaOperator/commaOperatorOtherInvalidOperation.ts(12,9): error TS2322: Type 'T2' is not assignable to type 'T1'.
'T1' could be instantiated with an arbitrary type which could be unrelated to 'T2'.
==== tests/cases/conformance/expressions/commaOperator/commaOperatorOtherInvalidOperation.ts (2 errors) ====
//Expect to have compiler errors
//Comma operator in function arguments and return
function foo(x: number, y: string) {
return x, y;
}
var resultIsString: number = foo(1, "123"); //error here
~~~~~~~~~~~~~~
!!! error TS2322: Type 'string' is not assignable to type 'number'.
//TypeParameters
function foo1<T1, T2>() {
var x: T1;
var y: T2;
var result: T1 = (x, y); //error here
~~~~~~
!!! error TS2322: Type 'T2' is not assignable to type 'T1'.
!!! error TS2322: 'T1' could be instantiated with an arbitrary type which could be unrelated to 'T2'.
}