Skip to content

Commit cbe4e60

Browse files
committed
Move JSON parse-with-source types from esnext to es2025
The proposal-json-parse-with-source is Stage 4 and part of ES2025, so the lib should live in es2025.json.d.ts, not esnext.json.d.ts.
1 parent 347330f commit cbe4e60

File tree

7 files changed

+30
-30
lines changed

7 files changed

+30
-30
lines changed

src/compiler/commandLineParser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ const libEntries: [string, string][] = [
237237
["es2025.iterator", "lib.es2025.iterator.d.ts"],
238238
["es2025.promise", "lib.es2025.promise.d.ts"],
239239
["es2025.regexp", "lib.es2025.regexp.d.ts"],
240+
["es2025.json", "lib.es2025.json.d.ts"],
240241
// Fallback for backward compatibility
241242
["esnext.asynciterable", "lib.es2018.asynciterable.d.ts"],
242243
["esnext.symbol", "lib.es2019.symbol.d.ts"],
@@ -259,7 +260,6 @@ const libEntries: [string, string][] = [
259260
["esnext.sharedmemory", "lib.esnext.sharedmemory.d.ts"],
260261
["esnext.temporal", "lib.esnext.temporal.d.ts"],
261262
["esnext.typedarrays", "lib.esnext.typedarrays.d.ts"],
262-
["esnext.json", "lib.esnext.json.d.ts"],
263263
// Decorators
264264
["decorators", "lib.decorators.d.ts"],
265265
["decorators.legacy", "lib.decorators.legacy.d.ts"],

src/lib/es2025.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
/// <reference lib="es2025.iterator" />
66
/// <reference lib="es2025.promise" />
77
/// <reference lib="es2025.regexp" />
8+
/// <reference lib="es2025.json" />

src/lib/esnext.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,3 @@
99
/// <reference lib="esnext.typedarrays" />
1010
/// <reference lib="esnext.temporal" />
1111
/// <reference lib="esnext.date" />
12-
/// <reference lib="esnext.json" />

src/lib/libs.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
"es2025.iterator",
8787
"es2025.promise",
8888
"es2025.regexp",
89+
"es2025.json",
8990
"esnext.array",
9091
"esnext.collection",
9192
"esnext.date",
@@ -96,7 +97,6 @@
9697
"esnext.sharedmemory",
9798
"esnext.temporal",
9899
"esnext.typedarrays",
99-
"esnext.json",
100100
"decorators",
101101
"decorators.legacy",
102102
// Default libraries

tests/baselines/reference/jsonParseWithSource.symbols

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,63 +4,63 @@
44
// JSON.rawJSON
55
const raw = JSON.rawJSON("123");
66
>raw : Symbol(raw, Decl(jsonParseWithSource.ts, 1, 5))
7-
>JSON.rawJSON : Symbol(JSON.rawJSON, Decl(lib.esnext.json.d.ts, --, --))
8-
>JSON : Symbol(JSON, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.esnext.json.d.ts, --, --))
9-
>rawJSON : Symbol(JSON.rawJSON, Decl(lib.esnext.json.d.ts, --, --))
7+
>JSON.rawJSON : Symbol(JSON.rawJSON, Decl(lib.es2025.json.d.ts, --, --))
8+
>JSON : Symbol(JSON, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2025.json.d.ts, --, --))
9+
>rawJSON : Symbol(JSON.rawJSON, Decl(lib.es2025.json.d.ts, --, --))
1010

1111
const rawStr: string = raw.rawJSON;
1212
>rawStr : Symbol(rawStr, Decl(jsonParseWithSource.ts, 2, 5))
13-
>raw.rawJSON : Symbol(RawJSON.rawJSON, Decl(lib.esnext.json.d.ts, --, --))
13+
>raw.rawJSON : Symbol(RawJSON.rawJSON, Decl(lib.es2025.json.d.ts, --, --))
1414
>raw : Symbol(raw, Decl(jsonParseWithSource.ts, 1, 5))
15-
>rawJSON : Symbol(RawJSON.rawJSON, Decl(lib.esnext.json.d.ts, --, --))
15+
>rawJSON : Symbol(RawJSON.rawJSON, Decl(lib.es2025.json.d.ts, --, --))
1616

1717
JSON.stringify({ value: raw });
1818
>JSON.stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
19-
>JSON : Symbol(JSON, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.esnext.json.d.ts, --, --))
19+
>JSON : Symbol(JSON, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2025.json.d.ts, --, --))
2020
>stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
2121
>value : Symbol(value, Decl(jsonParseWithSource.ts, 3, 16))
2222
>raw : Symbol(raw, Decl(jsonParseWithSource.ts, 1, 5))
2323

2424
JSON.stringify({ n: JSON.rawJSON("12345678901234567890") });
2525
>JSON.stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
26-
>JSON : Symbol(JSON, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.esnext.json.d.ts, --, --))
26+
>JSON : Symbol(JSON, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2025.json.d.ts, --, --))
2727
>stringify : Symbol(JSON.stringify, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
2828
>n : Symbol(n, Decl(jsonParseWithSource.ts, 4, 16))
29-
>JSON.rawJSON : Symbol(JSON.rawJSON, Decl(lib.esnext.json.d.ts, --, --))
30-
>JSON : Symbol(JSON, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.esnext.json.d.ts, --, --))
31-
>rawJSON : Symbol(JSON.rawJSON, Decl(lib.esnext.json.d.ts, --, --))
29+
>JSON.rawJSON : Symbol(JSON.rawJSON, Decl(lib.es2025.json.d.ts, --, --))
30+
>JSON : Symbol(JSON, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2025.json.d.ts, --, --))
31+
>rawJSON : Symbol(JSON.rawJSON, Decl(lib.es2025.json.d.ts, --, --))
3232

3333
// JSON.isRawJSON
3434
const maybeRaw: unknown = {};
3535
>maybeRaw : Symbol(maybeRaw, Decl(jsonParseWithSource.ts, 7, 5))
3636

3737
if (JSON.isRawJSON(maybeRaw)) {
38-
>JSON.isRawJSON : Symbol(JSON.isRawJSON, Decl(lib.esnext.json.d.ts, --, --))
39-
>JSON : Symbol(JSON, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.esnext.json.d.ts, --, --))
40-
>isRawJSON : Symbol(JSON.isRawJSON, Decl(lib.esnext.json.d.ts, --, --))
38+
>JSON.isRawJSON : Symbol(JSON.isRawJSON, Decl(lib.es2025.json.d.ts, --, --))
39+
>JSON : Symbol(JSON, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2025.json.d.ts, --, --))
40+
>isRawJSON : Symbol(JSON.isRawJSON, Decl(lib.es2025.json.d.ts, --, --))
4141
>maybeRaw : Symbol(maybeRaw, Decl(jsonParseWithSource.ts, 7, 5))
4242

4343
const text: string = maybeRaw.rawJSON;
4444
>text : Symbol(text, Decl(jsonParseWithSource.ts, 9, 9))
45-
>maybeRaw.rawJSON : Symbol(RawJSON.rawJSON, Decl(lib.esnext.json.d.ts, --, --))
45+
>maybeRaw.rawJSON : Symbol(RawJSON.rawJSON, Decl(lib.es2025.json.d.ts, --, --))
4646
>maybeRaw : Symbol(maybeRaw, Decl(jsonParseWithSource.ts, 7, 5))
47-
>rawJSON : Symbol(RawJSON.rawJSON, Decl(lib.esnext.json.d.ts, --, --))
47+
>rawJSON : Symbol(RawJSON.rawJSON, Decl(lib.es2025.json.d.ts, --, --))
4848
}
4949

5050
// JSON.parse with reviver context
5151
JSON.parse('{"key":123}', (key, value, context) => {
52-
>JSON.parse : Symbol(JSON.parse, Decl(lib.es5.d.ts, --, --), Decl(lib.esnext.json.d.ts, --, --))
53-
>JSON : Symbol(JSON, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.esnext.json.d.ts, --, --))
54-
>parse : Symbol(JSON.parse, Decl(lib.es5.d.ts, --, --), Decl(lib.esnext.json.d.ts, --, --))
52+
>JSON.parse : Symbol(JSON.parse, Decl(lib.es5.d.ts, --, --), Decl(lib.es2025.json.d.ts, --, --))
53+
>JSON : Symbol(JSON, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2025.json.d.ts, --, --))
54+
>parse : Symbol(JSON.parse, Decl(lib.es5.d.ts, --, --), Decl(lib.es2025.json.d.ts, --, --))
5555
>key : Symbol(key, Decl(jsonParseWithSource.ts, 13, 27))
5656
>value : Symbol(value, Decl(jsonParseWithSource.ts, 13, 31))
5757
>context : Symbol(context, Decl(jsonParseWithSource.ts, 13, 38))
5858

5959
const src: string = context.source;
6060
>src : Symbol(src, Decl(jsonParseWithSource.ts, 14, 9))
61-
>context.source : Symbol(source, Decl(lib.esnext.json.d.ts, --, --))
61+
>context.source : Symbol(source, Decl(lib.es2025.json.d.ts, --, --))
6262
>context : Symbol(context, Decl(jsonParseWithSource.ts, 13, 38))
63-
>source : Symbol(source, Decl(lib.esnext.json.d.ts, --, --))
63+
>source : Symbol(source, Decl(lib.es2025.json.d.ts, --, --))
6464

6565
return value;
6666
>value : Symbol(value, Decl(jsonParseWithSource.ts, 13, 31))
@@ -69,14 +69,14 @@ JSON.parse('{"key":123}', (key, value, context) => {
6969

7070
// Existing JSON.parse overloads still work
7171
JSON.parse("{}");
72-
>JSON.parse : Symbol(JSON.parse, Decl(lib.es5.d.ts, --, --), Decl(lib.esnext.json.d.ts, --, --))
73-
>JSON : Symbol(JSON, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.esnext.json.d.ts, --, --))
74-
>parse : Symbol(JSON.parse, Decl(lib.es5.d.ts, --, --), Decl(lib.esnext.json.d.ts, --, --))
72+
>JSON.parse : Symbol(JSON.parse, Decl(lib.es5.d.ts, --, --), Decl(lib.es2025.json.d.ts, --, --))
73+
>JSON : Symbol(JSON, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2025.json.d.ts, --, --))
74+
>parse : Symbol(JSON.parse, Decl(lib.es5.d.ts, --, --), Decl(lib.es2025.json.d.ts, --, --))
7575

7676
JSON.parse('{"a":1}', (key, value) => value);
77-
>JSON.parse : Symbol(JSON.parse, Decl(lib.es5.d.ts, --, --), Decl(lib.esnext.json.d.ts, --, --))
78-
>JSON : Symbol(JSON, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.esnext.json.d.ts, --, --))
79-
>parse : Symbol(JSON.parse, Decl(lib.es5.d.ts, --, --), Decl(lib.esnext.json.d.ts, --, --))
77+
>JSON.parse : Symbol(JSON.parse, Decl(lib.es5.d.ts, --, --), Decl(lib.es2025.json.d.ts, --, --))
78+
>JSON : Symbol(JSON, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2025.json.d.ts, --, --))
79+
>parse : Symbol(JSON.parse, Decl(lib.es5.d.ts, --, --), Decl(lib.es2025.json.d.ts, --, --))
8080
>key : Symbol(key, Decl(jsonParseWithSource.ts, 20, 23))
8181
>value : Symbol(value, Decl(jsonParseWithSource.ts, 20, 27))
8282
>value : Symbol(value, Decl(jsonParseWithSource.ts, 20, 27))

tests/cases/compiler/jsonParseWithSource.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @lib: esnext
1+
// @lib: es2025
22
// @strictNullChecks: true
33

44
// JSON.rawJSON

0 commit comments

Comments
 (0)