diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 08215b5bcfe8a..5bd7415391173 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -74,7 +74,7 @@ namespace ts { ["esnext.array", "lib.es2019.array.d.ts"], ["esnext.symbol", "lib.es2019.symbol.d.ts"], ["esnext.asynciterable", "lib.es2018.asynciterable.d.ts"], - ["esnext.intl", "lib.esnext.intl.d.ts"], + ["esnext.intl", "es2018.intl.d.ts"], ["esnext.bigint", "lib.es2020.bigint.d.ts"], ["esnext.string", "lib.es2021.string.d.ts"], ["esnext.promise", "lib.es2021.promise.d.ts"], diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 482bc94c150dd..2d36fb2692f09 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -606,6 +606,7 @@ namespace ts { AsyncIterableIterator: emptyArray, AsyncGenerator: emptyArray, AsyncGeneratorFunction: emptyArray, + NumberFormat: ["formatToParts"] }, es2019: { Array: ["flat", "flatMap"], @@ -626,9 +627,6 @@ namespace ts { es2021: { PromiseConstructor: ["any"], String: ["replaceAll"] - }, - esnext: { - NumberFormat: ["formatToParts"] } }; } diff --git a/src/lib/es2018.intl.d.ts b/src/lib/es2018.intl.d.ts index 278f404646b41..e25624cf91160 100644 --- a/src/lib/es2018.intl.d.ts +++ b/src/lib/es2018.intl.d.ts @@ -38,4 +38,15 @@ declare namespace Intl { options?: PluralRulesOptions, ): string[]; }; + + type NumberFormatPartTypes = "compact" | "currency" | "decimal" | "exponentInteger" | "exponentMinusSign" | "exponentSeparator" | "fraction" | "group" | "infinity" | "integer" | "literal" | "minusSign" | "nan" | "plusSign" | "percentSign" | "unit" | "unknown"; + + interface NumberFormatPart { + type: NumberFormatPartTypes; + value: string; + } + + interface NumberFormat { + formatToParts(number?: number | bigint): NumberFormatPart[]; + } } diff --git a/src/lib/esnext.d.ts b/src/lib/esnext.d.ts index 4a3ac819c1900..f24c0d3b7e06b 100644 --- a/src/lib/esnext.d.ts +++ b/src/lib/esnext.d.ts @@ -1,2 +1 @@ /// -/// diff --git a/src/lib/esnext.intl.d.ts b/src/lib/esnext.intl.d.ts deleted file mode 100644 index 2f2f021f8750e..0000000000000 --- a/src/lib/esnext.intl.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -declare namespace Intl { - type NumberFormatPartTypes = "compact" | "currency" | "decimal" | "exponentInteger" | "exponentMinusSign" | "exponentSeparator" | "fraction" | "group" | "infinity" | "integer" | "literal" | "minusSign" | "nan" | "plusSign" | "percentSign" | "unit" | "unknown"; - - interface NumberFormatPart { - type: NumberFormatPartTypes; - value: string; - } - - interface NumberFormat { - formatToParts(number?: number | bigint): NumberFormatPart[]; - } -} diff --git a/src/lib/libs.json b/src/lib/libs.json index 0eb3d7b657a34..0927733ceedf5 100644 --- a/src/lib/libs.json +++ b/src/lib/libs.json @@ -51,7 +51,6 @@ "es2021.string", "es2021.promise", "es2021.weakref", - "esnext.intl", // Default libraries "es5.full", "es2015.full", diff --git a/tests/baselines/reference/bigintWithLib.symbols b/tests/baselines/reference/bigintWithLib.symbols index f8f7c6bb8812d..c197f9e156794 100644 --- a/tests/baselines/reference/bigintWithLib.symbols +++ b/tests/baselines/reference/bigintWithLib.symbols @@ -241,16 +241,16 @@ let z = 12n; // should emit type bigint in declaration file // Test Intl methods with new parameter type new Intl.NumberFormat("fr").format(3000n); >new Intl.NumberFormat("fr").format : Symbol(Intl.NumberFormat.format, Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --)) ->Intl.NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --)) +>Intl.NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --)) >Intl : Symbol(Intl, Decl(lib.es5.d.ts, --, --), Decl(lib.es2017.intl.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.intl.d.ts, --, --)) ->NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --)) +>NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --)) >format : Symbol(Intl.NumberFormat.format, Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --)) new Intl.NumberFormat("fr").format(bigintVal); >new Intl.NumberFormat("fr").format : Symbol(Intl.NumberFormat.format, Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --)) ->Intl.NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --)) +>Intl.NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --)) >Intl : Symbol(Intl, Decl(lib.es5.d.ts, --, --), Decl(lib.es2017.intl.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.intl.d.ts, --, --)) ->NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --)) +>NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --)) >format : Symbol(Intl.NumberFormat.format, Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --)) >bigintVal : Symbol(bigintVal, Decl(bigintWithLib.ts, 1, 3)) diff --git a/tests/baselines/reference/doYouNeedToChangeYourTargetLibraryES2016Plus.errors.txt b/tests/baselines/reference/doYouNeedToChangeYourTargetLibraryES2016Plus.errors.txt index 05d5e04b51fe3..f373549df379f 100644 --- a/tests/baselines/reference/doYouNeedToChangeYourTargetLibraryES2016Plus.errors.txt +++ b/tests/baselines/reference/doYouNeedToChangeYourTargetLibraryES2016Plus.errors.txt @@ -16,21 +16,21 @@ tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(20,27): err 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. 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. 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. -tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(26,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. -tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(27,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. -tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(28,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. -tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(29,32): error TS2550: Property 'trimStart' does not exist on type '""'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2019' or later. -tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(30,30): error TS2550: Property 'trimEnd' does not exist on type '""'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2019' or later. -tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(31,31): error TS2550: Property 'trimLeft' does not exist on type '""'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2019' or later. -tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(32,32): error TS2550: Property 'trimRight' does not exist on type '""'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2019' or later. -tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(33,45): error TS2550: Property 'description' does not exist on type 'symbol'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2019' or later. -tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(36,39): error TS2550: Property 'allSettled' does not exist on type 'PromiseConstructor'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. -tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(37,31): error TS2550: Property 'matchAll' does not exist on type '""'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. -tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(38,47): error TS2550: Property 'matchAll' does not exist on type 'SymbolConstructor'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. -tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(39,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. -tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(42,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. -tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(43,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. -tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(46,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. +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. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(28,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. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(29,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. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(30,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. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(31,32): error TS2550: Property 'trimStart' does not exist on type '""'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2019' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(32,30): error TS2550: Property 'trimEnd' does not exist on type '""'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2019' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(33,31): error TS2550: Property 'trimLeft' does not exist on type '""'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2019' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(34,32): error TS2550: Property 'trimRight' does not exist on type '""'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2019' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(35,45): error TS2550: Property 'description' does not exist on type 'symbol'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2019' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(38,39): error TS2550: Property 'allSettled' does not exist on type 'PromiseConstructor'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(39,31): error TS2550: Property 'matchAll' does not exist on type '""'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(40,47): error TS2550: Property 'matchAll' does not exist on type 'SymbolConstructor'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(41,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. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(44,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. +tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(45,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. ==== tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts (33 errors) ==== @@ -93,6 +93,10 @@ tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(46,70): err const testAsyncIterableIterator: AsyncIterableIterator = null as any; ~~~~~~~~~~~~~~~~~~~~~ !!! error TS2583: Cannot find name 'AsyncIterableIterator'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2018' or later. + const testNumberFormatFormatToParts = new Intl.NumberFormat("en-US").formatToParts(); + ~~~~~~~~~~~~~ +!!! 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. + // es2019 const testArrayFlat = [].flat(); @@ -141,9 +145,4 @@ tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts(46,70): err const testStringReplaceAll = "".replaceAll(); ~~~~~~~~~~ !!! 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. - - // esnext - const testNumberFormatFormatToParts = new Intl.NumberFormat("en-US").formatToParts(); - ~~~~~~~~~~~~~ -!!! 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. \ No newline at end of file diff --git a/tests/baselines/reference/doYouNeedToChangeYourTargetLibraryES2016Plus.js b/tests/baselines/reference/doYouNeedToChangeYourTargetLibraryES2016Plus.js index 0a4f15227b782..baa35774a37db 100644 --- a/tests/baselines/reference/doYouNeedToChangeYourTargetLibraryES2016Plus.js +++ b/tests/baselines/reference/doYouNeedToChangeYourTargetLibraryES2016Plus.js @@ -22,6 +22,8 @@ const testAsyncGenerator: AsyncGenerator = null as any; const testAsyncGeneratorFunction: AsyncGeneratorFunction = null as any; const testAsyncIterable: AsyncIterable = null as any; const testAsyncIterableIterator: AsyncIterableIterator = null as any; +const testNumberFormatFormatToParts = new Intl.NumberFormat("en-US").formatToParts(); + // es2019 const testArrayFlat = [].flat(); @@ -42,9 +44,6 @@ const testBigInt = BigInt(123); // es2021 const testPromiseAny = Promise.any([]); const testStringReplaceAll = "".replaceAll(); - -// esnext -const testNumberFormatFormatToParts = new Intl.NumberFormat("en-US").formatToParts(); //// [doYouNeedToChangeYourTargetLibraryES2016Plus.js] @@ -69,6 +68,7 @@ var testAsyncGenerator = null; var testAsyncGeneratorFunction = null; var testAsyncIterable = null; var testAsyncIterableIterator = null; +var testNumberFormatFormatToParts = new Intl.NumberFormat("en-US").formatToParts(); // es2019 var testArrayFlat = [].flat(); var testArrayFlatMap = [].flatMap(); @@ -86,5 +86,3 @@ var testBigInt = BigInt(123); // es2021 var testPromiseAny = Promise.any([]); var testStringReplaceAll = "".replaceAll(); -// esnext -var testNumberFormatFormatToParts = new Intl.NumberFormat("en-US").formatToParts(); diff --git a/tests/baselines/reference/doYouNeedToChangeYourTargetLibraryES2016Plus.symbols b/tests/baselines/reference/doYouNeedToChangeYourTargetLibraryES2016Plus.symbols index 060c494e30149..3d161e8ee78ff 100644 --- a/tests/baselines/reference/doYouNeedToChangeYourTargetLibraryES2016Plus.symbols +++ b/tests/baselines/reference/doYouNeedToChangeYourTargetLibraryES2016Plus.symbols @@ -69,60 +69,60 @@ const testAsyncIterable: AsyncIterable = null as any; const testAsyncIterableIterator: AsyncIterableIterator = null as any; >testAsyncIterableIterator : Symbol(testAsyncIterableIterator, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 22, 5)) +const testNumberFormatFormatToParts = new Intl.NumberFormat("en-US").formatToParts(); +>testNumberFormatFormatToParts : Symbol(testNumberFormatFormatToParts, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 23, 5)) +>Intl.NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Intl : Symbol(Intl, Decl(lib.es5.d.ts, --, --)) +>NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + + // es2019 const testArrayFlat = [].flat(); ->testArrayFlat : Symbol(testArrayFlat, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 25, 5)) +>testArrayFlat : Symbol(testArrayFlat, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 27, 5)) const testArrayFlatMap = [].flatMap(); ->testArrayFlatMap : Symbol(testArrayFlatMap, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 26, 5)) +>testArrayFlatMap : Symbol(testArrayFlatMap, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 28, 5)) const testObjectConstructorFromEntries = Object.fromEntries({}); ->testObjectConstructorFromEntries : Symbol(testObjectConstructorFromEntries, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 27, 5)) +>testObjectConstructorFromEntries : Symbol(testObjectConstructorFromEntries, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 29, 5)) >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) const testStringTrimStart = "".trimStart(); ->testStringTrimStart : Symbol(testStringTrimStart, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 28, 5)) +>testStringTrimStart : Symbol(testStringTrimStart, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 30, 5)) const testStringTrimEnd = "".trimEnd(); ->testStringTrimEnd : Symbol(testStringTrimEnd, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 29, 5)) +>testStringTrimEnd : Symbol(testStringTrimEnd, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 31, 5)) const testStringTrimLeft = "".trimLeft(); ->testStringTrimLeft : Symbol(testStringTrimLeft, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 30, 5)) +>testStringTrimLeft : Symbol(testStringTrimLeft, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 32, 5)) const testStringTrimRight = "".trimRight(); ->testStringTrimRight : Symbol(testStringTrimRight, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 31, 5)) +>testStringTrimRight : Symbol(testStringTrimRight, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 33, 5)) const testSymbolDescription = Symbol("foo").description; ->testSymbolDescription : Symbol(testSymbolDescription, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 32, 5)) +>testSymbolDescription : Symbol(testSymbolDescription, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 34, 5)) >Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) // es2020 const testPromiseAllSettled = Promise.allSettled([]); ->testPromiseAllSettled : Symbol(testPromiseAllSettled, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 35, 5)) +>testPromiseAllSettled : Symbol(testPromiseAllSettled, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 37, 5)) >Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) const testStringMatchAll = "".matchAll(); ->testStringMatchAll : Symbol(testStringMatchAll, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 36, 5)) +>testStringMatchAll : Symbol(testStringMatchAll, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 38, 5)) const testRegExpMatchAll = /matchAll/g[Symbol.matchAll]("matchAll"); ->testRegExpMatchAll : Symbol(testRegExpMatchAll, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 37, 5)) +>testRegExpMatchAll : Symbol(testRegExpMatchAll, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 39, 5)) >Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) const testBigInt = BigInt(123); ->testBigInt : Symbol(testBigInt, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 38, 5)) +>testBigInt : Symbol(testBigInt, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 40, 5)) // es2021 const testPromiseAny = Promise.any([]); ->testPromiseAny : Symbol(testPromiseAny, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 41, 5)) +>testPromiseAny : Symbol(testPromiseAny, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 43, 5)) >Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) const testStringReplaceAll = "".replaceAll(); ->testStringReplaceAll : Symbol(testStringReplaceAll, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 42, 5)) - -// esnext -const testNumberFormatFormatToParts = new Intl.NumberFormat("en-US").formatToParts(); ->testNumberFormatFormatToParts : Symbol(testNumberFormatFormatToParts, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 45, 5)) ->Intl.NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->Intl : Symbol(Intl, Decl(lib.es5.d.ts, --, --)) ->NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>testStringReplaceAll : Symbol(testStringReplaceAll, Decl(doYouNeedToChangeYourTargetLibraryES2016Plus.ts, 44, 5)) diff --git a/tests/baselines/reference/doYouNeedToChangeYourTargetLibraryES2016Plus.types b/tests/baselines/reference/doYouNeedToChangeYourTargetLibraryES2016Plus.types index 95bd9e9fb15b6..d25a0297b9b84 100644 --- a/tests/baselines/reference/doYouNeedToChangeYourTargetLibraryES2016Plus.types +++ b/tests/baselines/reference/doYouNeedToChangeYourTargetLibraryES2016Plus.types @@ -147,6 +147,18 @@ const testAsyncIterableIterator: AsyncIterableIterator = null as any; >null as any : any >null : null +const testNumberFormatFormatToParts = new Intl.NumberFormat("en-US").formatToParts(); +>testNumberFormatFormatToParts : any +>new Intl.NumberFormat("en-US").formatToParts() : any +>new Intl.NumberFormat("en-US").formatToParts : any +>new Intl.NumberFormat("en-US") : Intl.NumberFormat +>Intl.NumberFormat : { (locales?: string | string[], options?: Intl.NumberFormatOptions): Intl.NumberFormat; new (locales?: string | string[], options?: Intl.NumberFormatOptions): Intl.NumberFormat; supportedLocalesOf(locales: string | string[], options?: Intl.NumberFormatOptions): string[]; } +>Intl : typeof Intl +>NumberFormat : { (locales?: string | string[], options?: Intl.NumberFormatOptions): Intl.NumberFormat; new (locales?: string | string[], options?: Intl.NumberFormatOptions): Intl.NumberFormat; supportedLocalesOf(locales: string | string[], options?: Intl.NumberFormatOptions): string[]; } +>"en-US" : "en-US" +>formatToParts : any + + // es2019 const testArrayFlat = [].flat(); >testArrayFlat : any @@ -254,15 +266,3 @@ const testStringReplaceAll = "".replaceAll(); >"" : "" >replaceAll : any -// esnext -const testNumberFormatFormatToParts = new Intl.NumberFormat("en-US").formatToParts(); ->testNumberFormatFormatToParts : any ->new Intl.NumberFormat("en-US").formatToParts() : any ->new Intl.NumberFormat("en-US").formatToParts : any ->new Intl.NumberFormat("en-US") : Intl.NumberFormat ->Intl.NumberFormat : { (locales?: string | string[], options?: Intl.NumberFormatOptions): Intl.NumberFormat; new (locales?: string | string[], options?: Intl.NumberFormatOptions): Intl.NumberFormat; supportedLocalesOf(locales: string | string[], options?: Intl.NumberFormatOptions): string[]; } ->Intl : typeof Intl ->NumberFormat : { (locales?: string | string[], options?: Intl.NumberFormatOptions): Intl.NumberFormat; new (locales?: string | string[], options?: Intl.NumberFormatOptions): Intl.NumberFormat; supportedLocalesOf(locales: string | string[], options?: Intl.NumberFormatOptions): string[]; } ->"en-US" : "en-US" ->formatToParts : any - diff --git a/tests/baselines/reference/formatToPartsBigInt.symbols b/tests/baselines/reference/formatToPartsBigInt.symbols index f3037bfef10ed..db1b467cf278c 100644 --- a/tests/baselines/reference/formatToPartsBigInt.symbols +++ b/tests/baselines/reference/formatToPartsBigInt.symbols @@ -3,17 +3,17 @@ // Test Intl methods with new parameter type new Intl.NumberFormat("fr").formatToParts(3000n); ->new Intl.NumberFormat("fr").formatToParts : Symbol(Intl.NumberFormat.formatToParts, Decl(lib.esnext.intl.d.ts, --, --)) ->Intl.NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.esnext.intl.d.ts, --, --)) ->Intl : Symbol(Intl, Decl(lib.es5.d.ts, --, --), Decl(lib.es2017.intl.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.intl.d.ts, --, --) ... and 1 more) ->NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.esnext.intl.d.ts, --, --)) ->formatToParts : Symbol(Intl.NumberFormat.formatToParts, Decl(lib.esnext.intl.d.ts, --, --)) +>new Intl.NumberFormat("fr").formatToParts : Symbol(Intl.NumberFormat.formatToParts, Decl(lib.es2018.intl.d.ts, --, --)) +>Intl.NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --)) +>Intl : Symbol(Intl, Decl(lib.es5.d.ts, --, --), Decl(lib.es2017.intl.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.intl.d.ts, --, --)) +>NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --)) +>formatToParts : Symbol(Intl.NumberFormat.formatToParts, Decl(lib.es2018.intl.d.ts, --, --)) new Intl.NumberFormat("fr").formatToParts(BigInt(123)); ->new Intl.NumberFormat("fr").formatToParts : Symbol(Intl.NumberFormat.formatToParts, Decl(lib.esnext.intl.d.ts, --, --)) ->Intl.NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.esnext.intl.d.ts, --, --)) ->Intl : Symbol(Intl, Decl(lib.es5.d.ts, --, --), Decl(lib.es2017.intl.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.intl.d.ts, --, --) ... and 1 more) ->NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.esnext.intl.d.ts, --, --)) ->formatToParts : Symbol(Intl.NumberFormat.formatToParts, Decl(lib.esnext.intl.d.ts, --, --)) +>new Intl.NumberFormat("fr").formatToParts : Symbol(Intl.NumberFormat.formatToParts, Decl(lib.es2018.intl.d.ts, --, --)) +>Intl.NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --)) +>Intl : Symbol(Intl, Decl(lib.es5.d.ts, --, --), Decl(lib.es2017.intl.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.intl.d.ts, --, --)) +>NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --)) +>formatToParts : Symbol(Intl.NumberFormat.formatToParts, Decl(lib.es2018.intl.d.ts, --, --)) >BigInt : Symbol(BigInt, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --)) diff --git a/tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts b/tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts index fdff373fee882..081debdb6f688 100644 --- a/tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts +++ b/tests/cases/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.ts @@ -23,6 +23,8 @@ const testAsyncGenerator: AsyncGenerator = null as any; const testAsyncGeneratorFunction: AsyncGeneratorFunction = null as any; const testAsyncIterable: AsyncIterable = null as any; const testAsyncIterableIterator: AsyncIterableIterator = null as any; +const testNumberFormatFormatToParts = new Intl.NumberFormat("en-US").formatToParts(); + // es2019 const testArrayFlat = [].flat(); @@ -43,6 +45,3 @@ const testBigInt = BigInt(123); // es2021 const testPromiseAny = Promise.any([]); const testStringReplaceAll = "".replaceAll(); - -// esnext -const testNumberFormatFormatToParts = new Intl.NumberFormat("en-US").formatToParts();