Skip to content

Commit c940acb

Browse files
committed
formatToParts is es2018
1 parent 63a65d7 commit c940acb

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/compiler/utilities.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,7 @@ namespace ts {
606606
AsyncIterableIterator: emptyArray,
607607
AsyncGenerator: emptyArray,
608608
AsyncGeneratorFunction: emptyArray,
609+
NumberFormat: ["formatToParts"]
609610
},
610611
es2019: {
611612
Array: ["flat", "flatMap"],
@@ -641,10 +642,7 @@ namespace ts {
641642
Float64Array: ["at"],
642643
BigInt64Array: ["at"],
643644
BigUint64Array: ["at"],
644-
ObjectConstructor: ["hasOwn"],
645-
},
646-
esnext: {
647-
NumberFormat: ["formatToParts"]
645+
ObjectConstructor: ["hasOwn"]
648646
}
649647
};
650648
}

tests/baselines/reference/doYouNeedToChangeYourTargetLibraryES2016Plus.errors.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(20,27): err
1616
tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(21,35): error TS2583: Cannot find name 'AsyncGeneratorFunction'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2018' or later.
1717
tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(22,26): error TS2583: Cannot find name 'AsyncIterable'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2018' or later.
1818
tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(23,34): error TS2583: Cannot find name 'AsyncIterableIterator'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2018' or later.
19-
tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(24,70): error TS2550: Property 'formatToParts' does not exist on type 'NumberFormat'. Do you need to change your target library? Try changing the 'lib' compiler option to 'esnext' or later.
19+
tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(24,70): error TS2550: Property 'formatToParts' does not exist on type 'NumberFormat'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2018' or later.
2020
tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(27,26): error TS2550: Property 'flat' does not exist on type 'undefined[]'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2019' or later.
2121
tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(28,29): error TS2550: Property 'flatMap' does not exist on type 'undefined[]'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2019' or later.
2222
tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(29,49): error TS2550: Property 'fromEntries' does not exist on type 'ObjectConstructor'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2019' or later.
@@ -95,7 +95,7 @@ tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(44,33): err
9595
!!! error TS2583: Cannot find name 'AsyncIterableIterator'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2018' or later.
9696
const testNumberFormatFormatToParts = new Intl.NumberFormat("en-US").formatToParts();
9797
~~~~~~~~~~~~~
98-
!!! error TS2550: Property 'formatToParts' does not exist on type 'NumberFormat'. Do you need to change your target library? Try changing the 'lib' compiler option to 'esnext' or later.
98+
!!! error TS2550: Property 'formatToParts' does not exist on type 'NumberFormat'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2018' or later.
9999

100100
// es2019
101101
const testArrayFlat = [].flat();

0 commit comments

Comments
 (0)