Skip to content

Commit 92ba1a8

Browse files
committed
Add .findLast() and .findLastIndex() (#69)
* Add .findLast(), .findLastIndex(), and es2023 target Signed-off-by: mbasov2 <[email protected]> * Update baselines Signed-off-by: mbasov2 <[email protected]>
1 parent 19defbf commit 92ba1a8

37 files changed

+1501
-50
lines changed

src/compiler/commandLineParser.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ namespace ts {
3434
["es2020", "lib.es2020.d.ts"],
3535
["es2021", "lib.es2021.d.ts"],
3636
["es2022", "lib.es2022.d.ts"],
37+
["es2023", "lib.es2023.d.ts"],
3738
["esnext", "lib.esnext.d.ts"],
3839
// Host only
3940
["dom", "lib.dom.d.ts"],
@@ -86,7 +87,8 @@ namespace ts {
8687
["es2022.object", "lib.es2022.object.d.ts"],
8788
["es2022.sharedmemory", "lib.es2022.sharedmemory.d.ts"],
8889
["es2022.string", "lib.es2022.string.d.ts"],
89-
["esnext.array", "lib.es2022.array.d.ts"],
90+
["es2023.array", "lib.es2023.array.d.ts"],
91+
["esnext.array", "lib.es2023.array.d.ts"],
9092
["esnext.symbol", "lib.es2019.symbol.d.ts"],
9193
["esnext.asynciterable", "lib.es2018.asynciterable.d.ts"],
9294
["esnext.intl", "lib.esnext.intl.d.ts"],
@@ -333,6 +335,7 @@ namespace ts {
333335
es2020: ScriptTarget.ES2020,
334336
es2021: ScriptTarget.ES2021,
335337
es2022: ScriptTarget.ES2022,
338+
es2023: ScriptTarget.ES2023,
336339
esnext: ScriptTarget.ESNext,
337340
})),
338341
affectsSourceFile: true,

src/compiler/types.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6741,6 +6741,7 @@ namespace ts {
67416741
ES2020 = 7,
67426742
ES2021 = 8,
67436743
ES2022 = 9,
6744+
ES2023 = 10,
67446745
ESNext = 99,
67456746
JSON = 100,
67466747
Latest = ESNext,
@@ -7220,16 +7221,17 @@ namespace ts {
72207221
ContainsTypeScript = 1 << 0,
72217222
ContainsJsx = 1 << 1,
72227223
ContainsESNext = 1 << 2,
7223-
ContainsES2022 = 1 << 3,
7224-
ContainsES2021 = 1 << 4,
7225-
ContainsES2020 = 1 << 5,
7226-
ContainsES2019 = 1 << 6,
7227-
ContainsES2018 = 1 << 7,
7228-
ContainsES2017 = 1 << 8,
7229-
ContainsES2016 = 1 << 9,
7230-
ContainsES2015 = 1 << 10,
7231-
ContainsGenerator = 1 << 11,
7232-
ContainsDestructuringAssignment = 1 << 12,
7224+
ContainsES2023 = 1 << 3,
7225+
ContainsES2022 = 1 << 4,
7226+
ContainsES2021 = 1 << 5,
7227+
ContainsES2020 = 1 << 6,
7228+
ContainsES2019 = 1 << 7,
7229+
ContainsES2018 = 1 << 8,
7230+
ContainsES2017 = 1 << 9,
7231+
ContainsES2016 = 1 << 10,
7232+
ContainsES2015 = 1 << 11,
7233+
ContainsGenerator = 1 << 12,
7234+
ContainsDestructuringAssignment = 1 << 13,
72337235

72347236
// Markers
72357237
// - Flags used to indicate that a subtree contains a specific transformation.
@@ -7258,6 +7260,7 @@ namespace ts {
72587260
AssertTypeScript = ContainsTypeScript,
72597261
AssertJsx = ContainsJsx,
72607262
AssertESNext = ContainsESNext,
7263+
AssertES2023 = ContainsES2023,
72617264
AssertES2022 = ContainsES2022,
72627265
AssertES2021 = ContainsES2021,
72637266
AssertES2020 = ContainsES2020,

src/compiler/utilities.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,20 @@ namespace ts {
645645
BigUint64Array: ["at"],
646646
ObjectConstructor: ["hasOwn"],
647647
Error: ["cause"]
648+
},
649+
es2023: {
650+
Array: ["findLast", "findLastIndex"],
651+
Int8Array: ["findLast", "findLastIndex"],
652+
Uint8Array: ["findLast", "findLastIndex"],
653+
Uint8ClampedArray: ["findLast", "findLastIndex"],
654+
Int16Array: ["findLast", "findLastIndex"],
655+
Uint16Array: ["findLast", "findLastIndex"],
656+
Int32Array: ["findLast", "findLastIndex"],
657+
Uint32Array: ["findLast", "findLastIndex"],
658+
Float32Array: ["findLast", "findLastIndex"],
659+
Float64Array: ["findLast", "findLastIndex"],
660+
BigInt64Array: ["findLast", "findLastIndex"],
661+
BigUint64Array: ["findLast", "findLastIndex"]
648662
}
649663
};
650664
}

src/compiler/utilitiesPublic.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ namespace ts {
1414
switch (getEmitScriptTarget(options)) {
1515
case ScriptTarget.ESNext:
1616
return "lib.esnext.full.d.ts";
17+
case ScriptTarget.ES2023:
18+
return "lib.es2023.full.d.ts";
1719
case ScriptTarget.ES2022:
1820
return "lib.es2022.full.d.ts";
1921
case ScriptTarget.ES2021:

src/lib/es2023.array.d.ts

Lines changed: 324 additions & 0 deletions
Large diffs are not rendered by default.

src/lib/es2023.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/// <reference lib="es2022" />
2+
/// <reference lib="es2023.array" />

src/lib/es2023.full.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/// <reference lib="es2023" />
2+
/// <reference lib="dom" />
3+
/// <reference lib="webworker.importscripts" />
4+
/// <reference lib="scripthost" />
5+
/// <reference lib="dom.iterable" />

src/lib/esnext.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
/// <reference lib="es2022" />
1+
/// <reference lib="es2023" />
22
/// <reference lib="esnext.intl" />

src/lib/libs.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"es2020",
1111
"es2021",
1212
"es2022",
13+
"es2023",
1314
"esnext",
1415
// Host only
1516
"dom.generated",
@@ -62,6 +63,7 @@
6263
"es2022.object",
6364
"es2022.sharedmemory",
6465
"es2022.string",
66+
"es2023.array",
6567
"esnext.intl",
6668
// Default libraries
6769
"es5.full",
@@ -73,6 +75,7 @@
7375
"es2020.full",
7476
"es2021.full",
7577
"es2022.full",
78+
"es2023.full",
7679
"esnext.full"
7780
],
7881
"paths": {

src/server/protocol.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3585,6 +3585,7 @@ namespace ts.server.protocol {
35853585
ES2020 = "ES2020",
35863586
ES2021 = "ES2021",
35873587
ES2022 = "ES2022",
3588+
ES2023 = "ES2023",
35883589
ESNext = "ESNext"
35893590
}
35903591

0 commit comments

Comments
 (0)