1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
//// [tests/cases/conformance/es2019/importMeta/importMetaNarrowing.ts] ////
=== importMetaNarrowing.ts ===
declare global { interface ImportMeta {foo?: () => void} };
>global : any
>foo : (() => void) | undefined
if (import.meta.foo) {
>import.meta.foo : (() => void) | undefined
>import.meta : ImportMeta
>meta : ImportMeta
>foo : (() => void) | undefined
import.meta.foo();
>import.meta.foo() : void
>import.meta.foo : () => void
>import.meta : ImportMeta
>meta : ImportMeta
>foo : () => void
}
|