22 lines
No EOL
1 KiB
Text
22 lines
No EOL
1 KiB
Text
==== 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;
|
|
}; |