mirror of
https://github.com/swc-project/swc.git
synced 2024-12-18 19:21:33 +03:00
24 lines
453 B
TypeScript
24 lines
453 B
TypeScript
declare var x: any;
|
|
|
|
if (x instanceof Function) { // 'any' is not narrowed when target type is 'Function'
|
|
x();
|
|
x(1, 2, 3);
|
|
x("hello!");
|
|
x.prop;
|
|
}
|
|
|
|
if (x instanceof Object) { // 'any' is not narrowed when target type is 'Object'
|
|
x.method();
|
|
x();
|
|
}
|
|
|
|
if (x instanceof Error) { // 'any' is narrowed to types other than 'Function'/'Object'
|
|
x.message;
|
|
x.mesage;
|
|
}
|
|
|
|
if (x instanceof Date) {
|
|
x.getDate();
|
|
x.getHuors();
|
|
}
|