TypeScript/tests/baselines/reference/importMetaNarrowing(module=es2020).types
Eli Barzilay d495957065 Add missing MetaProperty stuffs
Add missing parts in the binder and the checker to enable CFA +
narrowing of `import.meta` values.

Fixes #41468
2021-02-22 19:33:01 -05:00

20 lines
473 B
Plaintext

=== tests/cases/conformance/es2019/importMeta/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 : any
>foo : (() => void) | undefined
import.meta.foo();
>import.meta.foo() : void
>import.meta.foo : () => void
>import.meta : ImportMeta
>meta : any
>foo : () => void
}