-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Expand file tree
/
Copy pathresolveJsonModuleAllowArbitraryExtensionsNodeNext.symbols
More file actions
75 lines (52 loc) · 2.49 KB
/
resolveJsonModuleAllowArbitraryExtensionsNodeNext.symbols
File metadata and controls
75 lines (52 loc) · 2.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
//// [tests/cases/compiler/resolveJsonModuleAllowArbitraryExtensionsNodeNext.ts] ////
=== cjs/foo.d.json.ts ===
declare const data: ["foo", "bar", "baz"];
>data : Symbol(data, Decl(foo.d.json.ts, 0, 13))
export = data;
>data : Symbol(data, Decl(foo.d.json.ts, 0, 13))
=== cjs/index.mts ===
import data from "./foo.json" with { type: "json" };
>data : Symbol(data, Decl(index.mts, 0, 6))
data.default; // foo.d.json.ts is cjs format - error (`default` is whole file, file has no `default` member)
>data : Symbol(data, Decl(index.mts, 0, 6))
import data2 = require("./foo.json");
>data2 : Symbol(data2, Decl(index.mts, 1, 13))
data2.default; // `data2` is the whole json object, no `default`
>data2 : Symbol(data2, Decl(index.mts, 1, 13))
=== cjs/secondary.cts ===
import data from "./foo.json";
>data : Symbol(data, Decl(secondary.cts, 0, 6))
data.default; // error (cjs format `.d.json.ts`, export= object is require result)
>data : Symbol(data, Decl(secondary.cts, 0, 6))
import data2 = require("./foo.json");
>data2 : Symbol(data2, Decl(secondary.cts, 1, 13))
data2.default; // `data2` is the whole json object, no `default`
>data2 : Symbol(data2, Decl(secondary.cts, 1, 13))
=== esm/foo.d.json.ts ===
declare const data: ["foo", "bar", "baz"];
>data : Symbol(data, Decl(foo.d.json.ts, 0, 13))
export = data;
>data : Symbol(data, Decl(foo.d.json.ts, 0, 13))
=== esm/index.mts ===
import data from "./foo.json" with { type: "json" };
>data : Symbol(data, Decl(index.mts, 0, 6))
data.default; // foo.d.json.ts is cjs format despite package - error! (default import is already the whole json object)
>data : Symbol(data, Decl(index.mts, 0, 6))
import data2 = require("./foo.json");
>data2 : Symbol(data2, Decl(index.mts, 1, 13))
data2.default; // `data2` is the whole json object, no `default`
>data2 : Symbol(data2, Decl(index.mts, 1, 13))
=== esm/secondary.cts ===
import data from "./foo.json";
>data : Symbol(data, Decl(secondary.cts, 0, 6))
data.default; // `export=` object is the whole `require` result, hoisted to `default` by interop helper, no 2nd default
>data : Symbol(data, Decl(secondary.cts, 0, 6))
import data2 = require("./foo.json");
>data2 : Symbol(data2, Decl(secondary.cts, 1, 13))
data2.default; // `data2` is the whole json object, no `default`
>data2 : Symbol(data2, Decl(secondary.cts, 1, 13))
=== root.mts ===
import "./cjs/index.mjs";
import "./cjs/secondary.mjs";
import "./mjs/index.mjs";
import "./mjs/secondary.mjs";