1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
//// [instanceofOnInstantiationExpression.ts]
declare class Box<T> {
value: T;
}
declare const maybeBox: unknown;
maybeBox instanceof Box; // OK
maybeBox instanceof Box<number>; // error
maybeBox instanceof (Box<number>); // error
maybeBox instanceof ((Box<number>)); // error
Box<number> instanceof Object; // OK
(Box<number>) instanceof Object; // OK
((Box<number>)) instanceof Object; // OK
//// [instanceofOnInstantiationExpression.js]
maybeBox instanceof Box; // OK
maybeBox instanceof (Box); // error
maybeBox instanceof (Box); // error
maybeBox instanceof ((Box)); // error
(Box) instanceof Object; // OK
(Box) instanceof Object; // OK
((Box)) instanceof Object; // OK
|