-
-
Notifications
You must be signed in to change notification settings - Fork 671
/
Copy pathbinary-error.ts
22 lines (22 loc) · 1.55 KB
/
binary-error.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
class A { }
let b: A | null;
let c: i8 = 1;
b < c; // TS2365: Operator '<' cannot be applied to types 'binary-error/A | null' and 'i8'.
b > c; // TS2365: Operator '>' cannot be applied to types 'binary-error/A | null' and 'i8'.
b <= c; // TS2365: Operator '<=' cannot be applied to types 'binary-error/A | null' and 'i8'.
b >= c; // TS2365: Operator '>=' cannot be applied to types 'binary-error/A | null' and 'i8'.
b == c; // TS2365: Operator '==' cannot be applied to types 'binary-error/A | null' and 'i8'.
b != c; // TS2365: Operator '!=' cannot be applied to types 'binary-error/A | null' and 'i8'.
let d: () => void = (): void => { };
c + d; // TS2365: Operator '+' cannot be applied to types 'i8' and '() => void'.
c - d; // TS2365: Operator '-' cannot be applied to types 'i8' and '() => void'.
c * d; // TS2365: Operator '*' cannot be applied to types 'i8' and '() => void'.
c ** d; // TS2365: Operator '**' cannot be applied to types 'i8' and '() => void'.
c / d; // TS2365: Operator '/' cannot be applied to types 'i8' and '() => void'.
c % d; // TS2365: Operator '%' cannot be applied to types 'i8' and '() => void'.
d >> 1; // TS2469: The '>>' operator cannot be applied to type '() => void'.
d << 1; // TS2469: The '<<' operator cannot be applied to type '() => void'.
d >>> 1; // TS2469: The '>>>' operator cannot be applied to type '() => void'.
d & 1; // TS2469: The '&' operator cannot be applied to type '() => void'.
d | 1; // TS2469: The '|' operator cannot be applied to type '() => void'.
d ^ 1; // TS2469: The '^' operator cannot be applied to type '() => void'.