Skip to content

Commit 5e4281f

Browse files
authored
Add lib.esnext.temporal (#62628)
1 parent 2407979 commit 5e4281f

File tree

90 files changed

+31029
-767
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+31029
-767
lines changed

src/compiler/commandLineParser.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,11 +251,13 @@ const libEntries: [string, string][] = [
251251
// ESNext By-feature options
252252
["esnext.array", "lib.esnext.array.d.ts"],
253253
["esnext.collection", "lib.esnext.collection.d.ts"],
254+
["esnext.date", "lib.esnext.date.d.ts"],
254255
["esnext.decorators", "lib.esnext.decorators.d.ts"],
255256
["esnext.disposable", "lib.esnext.disposable.d.ts"],
256257
["esnext.error", "lib.esnext.error.d.ts"],
257258
["esnext.intl", "lib.esnext.intl.d.ts"],
258259
["esnext.sharedmemory", "lib.esnext.sharedmemory.d.ts"],
260+
["esnext.temporal", "lib.esnext.temporal.d.ts"],
259261
["esnext.typedarrays", "lib.esnext.typedarrays.d.ts"],
260262
// Decorators
261263
["decorators", "lib.decorators.d.ts"],

src/compiler/utilities.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1953,6 +1953,11 @@ export const getScriptTargetFeatures: () => ScriptTargetFeatures = /* @__PURE__
19531953
"fromHex",
19541954
],
19551955
})),
1956+
Date: new Map(Object.entries({
1957+
esnext: [
1958+
"toTemporalInstant",
1959+
],
1960+
})),
19561961
DisposableStack: new Map(Object.entries({
19571962
esnext: emptyArray,
19581963
})),

src/lib/esnext.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@
77
/// <reference lib="esnext.error" />
88
/// <reference lib="esnext.sharedmemory" />
99
/// <reference lib="esnext.typedarrays" />
10+
/// <reference lib="esnext.temporal" />
11+
/// <reference lib="esnext.date" />

src/lib/esnext.date.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/// <reference lib="esnext.temporal" />
2+
3+
interface Date {
4+
toTemporalInstant(): Temporal.Instant;
5+
}

src/lib/esnext.intl.d.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
1+
/// <reference lib="esnext.temporal" />
2+
13
declare namespace Intl {
4+
type FormattableTemporalObject = Temporal.PlainDate | Temporal.PlainYearMonth | Temporal.PlainMonthDay | Temporal.PlainTime | Temporal.PlainDateTime | Temporal.Instant;
5+
6+
interface DateTimeFormat {
7+
format(date?: FormattableTemporalObject | Date | number): string;
8+
formatToParts(date?: FormattableTemporalObject | Date | number): DateTimeFormatPart[];
9+
formatRange(startDate: FormattableTemporalObject | Date | number, endDate: FormattableTemporalObject | Date | number): string;
10+
formatRangeToParts(startDate: FormattableTemporalObject | Date | number, endDate: FormattableTemporalObject | Date | number): DateTimeRangeFormatPart[];
11+
}
12+
213
interface Locale {
314
/**
415
* Returns a list of one or more unique calendar identifiers for this locale.

src/lib/esnext.temporal.d.ts

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

src/lib/libs.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,13 @@
8888
"es2025.regexp",
8989
"esnext.array",
9090
"esnext.collection",
91+
"esnext.date",
9192
"esnext.decorators",
9293
"esnext.disposable",
9394
"esnext.error",
9495
"esnext.intl",
9596
"esnext.sharedmemory",
97+
"esnext.temporal",
9698
"esnext.typedarrays",
9799
"decorators",
98100
"decorators.legacy",

tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse --lib option with extra comma.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse --lib option with trailing white-space.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse invalid option of library flags.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)