22 lines
1 KiB
Plaintext
22 lines
1 KiB
Plaintext
==== tests/cases/compiler/arithmeticOnInvalidTypes2.ts (7 errors) ====
|
|
var obj = function f<T>(a: T, b: T) {
|
|
var z1 = a + b;
|
|
~~~~~
|
|
!!! Operator '+' cannot be applied to types 'T' and 'T'.
|
|
var z2 = a - b;
|
|
~
|
|
!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
|
~
|
|
!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
|
var z3 = a * b;
|
|
~
|
|
!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
|
~
|
|
!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
|
var z4 = a / b;
|
|
~
|
|
!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
|
~
|
|
!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
|
return a;
|
|
}; |