mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
35 lines
1.2 KiB
Plaintext
35 lines
1.2 KiB
Plaintext
narrowFromAnyWithInstanceof.ts(17,7): error TS2551: Property 'mesage' does not exist on type 'Error'. Did you mean 'message'?
|
|
narrowFromAnyWithInstanceof.ts(22,7): error TS2551: Property 'getHuors' does not exist on type 'Date'. Did you mean 'getHours'?
|
|
|
|
|
|
==== narrowFromAnyWithInstanceof.ts (2 errors) ====
|
|
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;
|
|
~~~~~~
|
|
!!! error TS2551: Property 'mesage' does not exist on type 'Error'. Did you mean 'message'?
|
|
!!! related TS2728 lib.es5.d.ts:--:--: 'message' is declared here.
|
|
}
|
|
|
|
if (x instanceof Date) {
|
|
x.getDate();
|
|
x.getHuors();
|
|
~~~~~~~~
|
|
!!! error TS2551: Property 'getHuors' does not exist on type 'Date'. Did you mean 'getHours'?
|
|
!!! related TS2728 lib.es5.d.ts:--:--: 'getHours' is declared here.
|
|
}
|
|
|