File tree Expand file tree Collapse file tree
tests/cases/conformance/es2019/importMeta Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,3 +26,16 @@ export let z = import.import.import.malkovich;
2626let globalA = import . meta;
2727let globalB = import . metal ;
2828let globalC = import . import . import . malkovich ;
29+
30+ // @Filename : assignmentTargets.ts
31+ export const foo : ImportMeta = import . meta. blah = import . meta. blue = import . meta;
32+ import . meta = foo ;
33+
34+ // @Filename augmentations.ts
35+ declare global {
36+ interface ImportMeta {
37+ wellKnownProperty : { a : number , b : string , c : boolean } ;
38+ }
39+ }
40+
41+ const { a, b, c } = import . meta. wellKnownProperty ;
Original file line number Diff line number Diff line change 1+
2+ // @target : es5
3+ // @module : commonjs
4+ // @lib : es5,dom
5+
6+ // @Filename : example.ts
7+ // Adapted from https://github.com/tc39/proposal-import-meta/tree/c3902a9ffe2e69a7ac42c19d7ea74cbdcea9b7fb#example
8+ ( async ( ) => {
9+ const response = await fetch ( new URL ( "../hamsters.jpg" , import . meta. url ) . toString ( ) ) ;
10+ const blob = await response . blob ( ) ;
11+
12+ const size = import . meta. scriptElement . dataset . size || 300 ;
13+
14+ const image = new Image ( ) ;
15+ image . src = URL . createObjectURL ( blob ) ;
16+ image . width = image . height = size ;
17+
18+ document . body . appendChild ( image ) ;
19+ } ) ( ) ;
20+
21+ // @Filename : moduleLookingFile01.ts
22+ export let x = import . meta;
23+ export let y = import . metal ;
24+ export let z = import . import . import . malkovich ;
25+
26+ // @Filename : scriptLookingFile01.ts
27+ let globalA = import . meta;
28+ let globalB = import . metal ;
29+ let globalC = import . import . import . malkovich ;
30+
31+ // @Filename : assignmentTargets.ts
32+ export const foo : ImportMeta = import . meta. blah = import . meta. blue = import . meta;
33+ import . meta = foo ;
34+
35+ // @Filename augmentations.ts
36+ declare global {
37+ interface ImportMeta {
38+ wellKnownProperty : { a : number , b : string , c : boolean } ;
39+ }
40+ }
41+
42+ const { a, b, c } = import . meta. wellKnownProperty ;
You can’t perform that action at this time.
0 commit comments