Skip to content

Commit 97cd51e

Browse files
Copilotjakebailey
andcommitted
Port PR #62628: Add Date.toTemporalInstant to getScriptTargetFeatures (#2810)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
1 parent e922b7b commit 97cd51e

3 files changed

Lines changed: 11 additions & 21 deletions

File tree

internal/checker/utilities.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1531,6 +1531,9 @@ var getFeatureMap = sync.OnceValue(func() map[string][]FeatureMapEntry {
15311531
"AsyncDisposableStack": {
15321532
{lib: "esnext", props: []string{}},
15331533
},
1534+
"Date": {
1535+
{lib: "esnext", props: []string{"toTemporalInstant"}},
1536+
},
15341537
}
15351538
})
15361539

testdata/baselines/reference/submodule/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.errors.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ doYouNeedToChangeYourTargetLibraryES2016Plus.ts(39,47): error TS2550: Property '
3131
doYouNeedToChangeYourTargetLibraryES2016Plus.ts(40,20): error TS2583: Cannot find name 'BigInt'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later.
3232
doYouNeedToChangeYourTargetLibraryES2016Plus.ts(43,32): error TS2550: Property 'any' does not exist on type 'PromiseConstructor'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2021' or later.
3333
doYouNeedToChangeYourTargetLibraryES2016Plus.ts(44,33): error TS2550: Property 'replaceAll' does not exist on type '""'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2021' or later.
34-
doYouNeedToChangeYourTargetLibraryES2016Plus.ts(47,46): error TS2339: Property 'toTemporalInstant' does not exist on type 'Date'.
34+
doYouNeedToChangeYourTargetLibraryES2016Plus.ts(47,46): error TS2550: Property 'toTemporalInstant' does not exist on type 'Date'. Do you need to change your target library? Try changing the 'lib' compiler option to 'esnext' or later.
3535

3636

3737
==== doYouNeedToChangeYourTargetLibraryES2016Plus.ts (34 errors) ====
@@ -149,5 +149,5 @@ doYouNeedToChangeYourTargetLibraryES2016Plus.ts(47,46): error TS2339: Property '
149149
// esnext
150150
const testDateToTemporalInstant = new Date().toTemporalInstant();
151151
~~~~~~~~~~~~~~~~~
152-
!!! error TS2339: Property 'toTemporalInstant' does not exist on type 'Date'.
152+
!!! error TS2550: Property 'toTemporalInstant' does not exist on type 'Date'. Do you need to change your target library? Try changing the 'lib' compiler option to 'esnext' or later.
153153

testdata/baselines/reference/submodule/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.errors.txt.diff

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,16 @@
1414
doYouNeedToChangeYourTargetLibraryES2016Plus.ts(17,111): error TS2550: Property 'groups' does not exist on type 'RegExpExecArray'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2018' or later.
1515
doYouNeedToChangeYourTargetLibraryES2016Plus.ts(18,33): error TS2550: Property 'dotAll' does not exist on type 'RegExp'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2018' or later.
1616
doYouNeedToChangeYourTargetLibraryES2016Plus.ts(19,38): error TS2550: Property 'PluralRules' does not exist on type 'typeof Intl'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2018' or later.
17-
@@= skipped -29, +23 lines =@@
18-
doYouNeedToChangeYourTargetLibraryES2016Plus.ts(40,20): error TS2583: Cannot find name 'BigInt'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later.
19-
doYouNeedToChangeYourTargetLibraryES2016Plus.ts(43,32): error TS2550: Property 'any' does not exist on type 'PromiseConstructor'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2021' or later.
20-
doYouNeedToChangeYourTargetLibraryES2016Plus.ts(44,33): error TS2550: Property 'replaceAll' does not exist on type '""'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2021' or later.
21-
-doYouNeedToChangeYourTargetLibraryES2016Plus.ts(47,46): error TS2550: Property 'toTemporalInstant' does not exist on type 'Date'. Do you need to change your target library? Try changing the 'lib' compiler option to 'esnext' or later.
22-
-
23-
-
17+
@@= skipped -32, +26 lines =@@
18+
doYouNeedToChangeYourTargetLibraryES2016Plus.ts(47,46): error TS2550: Property 'toTemporalInstant' does not exist on type 'Date'. Do you need to change your target library? Try changing the 'lib' compiler option to 'esnext' or later.
19+
20+
2421
-==== doYouNeedToChangeYourTargetLibraryES2016Plus.ts (40 errors) ====
25-
+doYouNeedToChangeYourTargetLibraryES2016Plus.ts(47,46): error TS2339: Property 'toTemporalInstant' does not exist on type 'Date'.
26-
+
27-
+
2822
+==== doYouNeedToChangeYourTargetLibraryES2016Plus.ts (34 errors) ====
2923
// es2016
3024
const testIncludes = ["hello"].includes("world");
3125
~~~~~~~~
32-
@@= skipped -40, +40 lines =@@
26+
@@= skipped -37, +37 lines =@@
3327
~~~~~~~
3428
!!! error TS2550: Property 'finally' does not exist on type 'Promise<unknown>'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2018' or later.
3529
const testRegExpMatchArrayGroups = "2019-04-30".match(/(?<year>[0-9]{4})-(?<month>[0-9]{2})-(?<day>[0-9]{2})/g).groups;
@@ -50,11 +44,4 @@
5044
-!!! error TS1503: Named capturing groups are only available when targeting 'ES2018' or later.
5145
~~~~~~
5246
!!! error TS2550: Property 'groups' does not exist on type 'RegExpExecArray'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2018' or later.
53-
const testRegExpDotAll = /foo/g.dotAll;
54-
@@= skipped -90, +78 lines =@@
55-
// esnext
56-
const testDateToTemporalInstant = new Date().toTemporalInstant();
57-
~~~~~~~~~~~~~~~~~
58-
-!!! error TS2550: Property 'toTemporalInstant' does not exist on type 'Date'. Do you need to change your target library? Try changing the 'lib' compiler option to 'esnext' or later.
59-
+!!! error TS2339: Property 'toTemporalInstant' does not exist on type 'Date'.
60-
47+
const testRegExpDotAll = /foo/g.dotAll;

0 commit comments

Comments
 (0)