|
| 1 | +tests/cases/compiler/relationalOperatorComparable.ts(5,14): error TS2365: Operator '<' cannot be applied to types 'number' and 'boolean'. |
| 2 | +tests/cases/compiler/relationalOperatorComparable.ts(6,14): error TS2365: Operator '<=' cannot be applied to types 'number' and 'boolean'. |
| 3 | +tests/cases/compiler/relationalOperatorComparable.ts(7,14): error TS2365: Operator '>=' cannot be applied to types 'number' and 'boolean'. |
| 4 | +tests/cases/compiler/relationalOperatorComparable.ts(8,14): error TS2365: Operator '>' cannot be applied to types 'number' and 'boolean'. |
| 5 | +tests/cases/compiler/relationalOperatorComparable.ts(9,14): error TS2365: Operator '<' cannot be applied to types 'boolean' and 'number'. |
| 6 | +tests/cases/compiler/relationalOperatorComparable.ts(10,14): error TS2365: Operator '<' cannot be applied to types 'boolean' and 'number'. |
| 7 | +tests/cases/compiler/relationalOperatorComparable.ts(11,14): error TS2365: Operator '<' cannot be applied to types 'string' and 'number'. |
| 8 | + |
| 9 | + |
| 10 | +==== tests/cases/compiler/relationalOperatorComparable.ts (7 errors) ==== |
| 11 | + function f(onethree: 1 | 3, two: 2) { |
| 12 | + const t = true; |
| 13 | + const f = false; |
| 14 | + let a1 = onethree < two; // ok |
| 15 | + let a2 = onethree < true; // error, number and boolean |
| 16 | + ~~~~~~~~~~~~~~~ |
| 17 | +!!! error TS2365: Operator '<' cannot be applied to types 'number' and 'boolean'. |
| 18 | + let a3 = onethree <= false; // error, number and boolean |
| 19 | + ~~~~~~~~~~~~~~~~~ |
| 20 | +!!! error TS2365: Operator '<=' cannot be applied to types 'number' and 'boolean'. |
| 21 | + let a4 = onethree >= t; // error, number and boolean |
| 22 | + ~~~~~~~~~~~~~ |
| 23 | +!!! error TS2365: Operator '>=' cannot be applied to types 'number' and 'boolean'. |
| 24 | + let a5 = onethree > f; // error, number and boolean |
| 25 | + ~~~~~~~~~~~~ |
| 26 | +!!! error TS2365: Operator '>' cannot be applied to types 'number' and 'boolean'. |
| 27 | + let a6 = true < onethree; // error, boolean and number |
| 28 | + ~~~~~~~~~~~~~~~ |
| 29 | +!!! error TS2365: Operator '<' cannot be applied to types 'boolean' and 'number'. |
| 30 | + let a7 = false < two; // error, boolean and number |
| 31 | + ~~~~~~~~~~~ |
| 32 | +!!! error TS2365: Operator '<' cannot be applied to types 'boolean' and 'number'. |
| 33 | + let a8 = 'foo' < onethree; // error, string and number |
| 34 | + ~~~~~~~~~~~~~~~~ |
| 35 | +!!! error TS2365: Operator '<' cannot be applied to types 'string' and 'number'. |
| 36 | + let a9 = onethree < 1; // ok |
| 37 | + let a10 = 1 < two; // ok |
| 38 | + let a11 = 2 < 1; // ok |
| 39 | + } |
| 40 | + |
0 commit comments