diff --git a/src/lib/es2023.intl.d.ts b/src/lib/es2023.intl.d.ts index b3de1fdd1020c..91d29c3d04e30 100644 --- a/src/lib/es2023.intl.d.ts +++ b/src/lib/es2023.intl.d.ts @@ -27,8 +27,12 @@ declare namespace Intl { source: "startRange" | "endRange" | "shared"; } + type StringNumericLiteral = `${number}` | "Infinity" | "-Infinity" | "+Infinity"; + interface NumberFormat { - formatRange(start: number | bigint, end: number | bigint): string; - formatRangeToParts(start: number | bigint, end: number | bigint): NumberRangeFormatPart[]; + format(value: number | bigint | StringNumericLiteral): string; + formatToParts(value: number | bigint | StringNumericLiteral): NumberFormatPart[]; + formatRange(start: number | bigint | StringNumericLiteral, end: number | bigint | StringNumericLiteral): string; + formatRangeToParts(start: number | bigint | StringNumericLiteral, end: number | bigint | StringNumericLiteral): NumberRangeFormatPart[]; } } diff --git a/tests/baselines/reference/intlNumberFormatES2023.js b/tests/baselines/reference/intlNumberFormatES2023.js index f9ab2faef8b59..983fe0ff00305 100644 --- a/tests/baselines/reference/intlNumberFormatES2023.js +++ b/tests/baselines/reference/intlNumberFormatES2023.js @@ -23,6 +23,14 @@ new Intl.NumberFormat('en-GB').formatRange(10, 100); new Intl.NumberFormat('en-GB').formatRange(10n, 1000n); new Intl.NumberFormat('en-GB').formatRangeToParts(10, 1000)[0]; new Intl.NumberFormat('en-GB').formatRangeToParts(10n, 1000n)[0]; + +// Arbitrary-precision string arguments +new Intl.NumberFormat('en-GB').format('-12.3E-4'); +new Intl.NumberFormat('en-GB').formatRange('123.4', '567.8'); +new Intl.NumberFormat('en-GB').formatRangeToParts('123E-4', '567E8'); +new Intl.NumberFormat('en-GB').format('Infinity'); +new Intl.NumberFormat('en-GB').format('-Infinity'); +new Intl.NumberFormat('en-GB').format('+Infinity'); //// [intlNumberFormatES2023.js] @@ -44,3 +52,10 @@ new Intl.NumberFormat('en-GB').formatRange(10, 100); new Intl.NumberFormat('en-GB').formatRange(10n, 1000n); new Intl.NumberFormat('en-GB').formatRangeToParts(10, 1000)[0]; new Intl.NumberFormat('en-GB').formatRangeToParts(10n, 1000n)[0]; +// Arbitrary-precision string arguments +new Intl.NumberFormat('en-GB').format('-12.3E-4'); +new Intl.NumberFormat('en-GB').formatRange('123.4', '567.8'); +new Intl.NumberFormat('en-GB').formatRangeToParts('123E-4', '567E8'); +new Intl.NumberFormat('en-GB').format('Infinity'); +new Intl.NumberFormat('en-GB').format('-Infinity'); +new Intl.NumberFormat('en-GB').format('+Infinity'); diff --git a/tests/baselines/reference/intlNumberFormatES2023.symbols b/tests/baselines/reference/intlNumberFormatES2023.symbols index ecc1738f1d714..ade51253237e2 100644 --- a/tests/baselines/reference/intlNumberFormatES2023.symbols +++ b/tests/baselines/reference/intlNumberFormatES2023.symbols @@ -87,3 +87,46 @@ new Intl.NumberFormat('en-GB').formatRangeToParts(10n, 1000n)[0]; >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, --, --), Decl(lib.es2023.intl.d.ts, --, --)) >formatRangeToParts : Symbol(Intl.NumberFormat.formatRangeToParts, Decl(lib.es2023.intl.d.ts, --, --)) +// Arbitrary-precision string arguments +new Intl.NumberFormat('en-GB').format('-12.3E-4'); +>new Intl.NumberFormat('en-GB').format : Symbol(Intl.NumberFormat.format, Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2023.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, --, --), Decl(lib.es2023.intl.d.ts, --, --)) +>Intl : Symbol(Intl, Decl(lib.es5.d.ts, --, --), Decl(lib.es2016.intl.d.ts, --, --), Decl(lib.es2017.intl.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2019.intl.d.ts, --, --) ... and 5 more) +>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, --, --), Decl(lib.es2023.intl.d.ts, --, --)) +>format : Symbol(Intl.NumberFormat.format, Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2023.intl.d.ts, --, --)) + +new Intl.NumberFormat('en-GB').formatRange('123.4', '567.8'); +>new Intl.NumberFormat('en-GB').formatRange : Symbol(Intl.NumberFormat.formatRange, Decl(lib.es2023.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, --, --), Decl(lib.es2023.intl.d.ts, --, --)) +>Intl : Symbol(Intl, Decl(lib.es5.d.ts, --, --), Decl(lib.es2016.intl.d.ts, --, --), Decl(lib.es2017.intl.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2019.intl.d.ts, --, --) ... and 5 more) +>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, --, --), Decl(lib.es2023.intl.d.ts, --, --)) +>formatRange : Symbol(Intl.NumberFormat.formatRange, Decl(lib.es2023.intl.d.ts, --, --)) + +new Intl.NumberFormat('en-GB').formatRangeToParts('123E-4', '567E8'); +>new Intl.NumberFormat('en-GB').formatRangeToParts : Symbol(Intl.NumberFormat.formatRangeToParts, Decl(lib.es2023.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, --, --), Decl(lib.es2023.intl.d.ts, --, --)) +>Intl : Symbol(Intl, Decl(lib.es5.d.ts, --, --), Decl(lib.es2016.intl.d.ts, --, --), Decl(lib.es2017.intl.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2019.intl.d.ts, --, --) ... and 5 more) +>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, --, --), Decl(lib.es2023.intl.d.ts, --, --)) +>formatRangeToParts : Symbol(Intl.NumberFormat.formatRangeToParts, Decl(lib.es2023.intl.d.ts, --, --)) + +new Intl.NumberFormat('en-GB').format('Infinity'); +>new Intl.NumberFormat('en-GB').format : Symbol(Intl.NumberFormat.format, Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2023.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, --, --), Decl(lib.es2023.intl.d.ts, --, --)) +>Intl : Symbol(Intl, Decl(lib.es5.d.ts, --, --), Decl(lib.es2016.intl.d.ts, --, --), Decl(lib.es2017.intl.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2019.intl.d.ts, --, --) ... and 5 more) +>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, --, --), Decl(lib.es2023.intl.d.ts, --, --)) +>format : Symbol(Intl.NumberFormat.format, Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2023.intl.d.ts, --, --)) + +new Intl.NumberFormat('en-GB').format('-Infinity'); +>new Intl.NumberFormat('en-GB').format : Symbol(Intl.NumberFormat.format, Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2023.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, --, --), Decl(lib.es2023.intl.d.ts, --, --)) +>Intl : Symbol(Intl, Decl(lib.es5.d.ts, --, --), Decl(lib.es2016.intl.d.ts, --, --), Decl(lib.es2017.intl.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2019.intl.d.ts, --, --) ... and 5 more) +>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, --, --), Decl(lib.es2023.intl.d.ts, --, --)) +>format : Symbol(Intl.NumberFormat.format, Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2023.intl.d.ts, --, --)) + +new Intl.NumberFormat('en-GB').format('+Infinity'); +>new Intl.NumberFormat('en-GB').format : Symbol(Intl.NumberFormat.format, Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2023.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, --, --), Decl(lib.es2023.intl.d.ts, --, --)) +>Intl : Symbol(Intl, Decl(lib.es5.d.ts, --, --), Decl(lib.es2016.intl.d.ts, --, --), Decl(lib.es2017.intl.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2019.intl.d.ts, --, --) ... and 5 more) +>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, --, --), Decl(lib.es2023.intl.d.ts, --, --)) +>format : Symbol(Intl.NumberFormat.format, Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2023.intl.d.ts, --, --)) + diff --git a/tests/baselines/reference/intlNumberFormatES2023.types b/tests/baselines/reference/intlNumberFormatES2023.types index 9cf6978515490..f2f8ce318db8c 100644 --- a/tests/baselines/reference/intlNumberFormatES2023.types +++ b/tests/baselines/reference/intlNumberFormatES2023.types @@ -158,8 +158,8 @@ new Intl.NumberFormat('en-GB', { useGrouping: 'always' }); new Intl.NumberFormat('en-GB').formatRange(10, 100); >new Intl.NumberFormat('en-GB').formatRange(10, 100) : string > : ^^^^^^ ->new Intl.NumberFormat('en-GB').formatRange : (start: number | bigint, end: number | bigint) => string -> : ^ ^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>new Intl.NumberFormat('en-GB').formatRange : (start: number | bigint | Intl.StringNumericLiteral, end: number | bigint | Intl.StringNumericLiteral) => string +> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >new Intl.NumberFormat('en-GB') : Intl.NumberFormat > : ^^^^^^^^^^^^^^^^^ >Intl.NumberFormat : Intl.NumberFormatConstructor @@ -170,8 +170,8 @@ new Intl.NumberFormat('en-GB').formatRange(10, 100); > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >'en-GB' : "en-GB" > : ^^^^^^^ ->formatRange : (start: number | bigint, end: number | bigint) => string -> : ^ ^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>formatRange : (start: number | bigint | Intl.StringNumericLiteral, end: number | bigint | Intl.StringNumericLiteral) => string +> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >10 : 10 > : ^^ >100 : 100 @@ -180,8 +180,8 @@ new Intl.NumberFormat('en-GB').formatRange(10, 100); new Intl.NumberFormat('en-GB').formatRange(10n, 1000n); >new Intl.NumberFormat('en-GB').formatRange(10n, 1000n) : string > : ^^^^^^ ->new Intl.NumberFormat('en-GB').formatRange : (start: number | bigint, end: number | bigint) => string -> : ^ ^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>new Intl.NumberFormat('en-GB').formatRange : (start: number | bigint | Intl.StringNumericLiteral, end: number | bigint | Intl.StringNumericLiteral) => string +> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >new Intl.NumberFormat('en-GB') : Intl.NumberFormat > : ^^^^^^^^^^^^^^^^^ >Intl.NumberFormat : Intl.NumberFormatConstructor @@ -192,8 +192,8 @@ new Intl.NumberFormat('en-GB').formatRange(10n, 1000n); > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >'en-GB' : "en-GB" > : ^^^^^^^ ->formatRange : (start: number | bigint, end: number | bigint) => string -> : ^ ^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>formatRange : (start: number | bigint | Intl.StringNumericLiteral, end: number | bigint | Intl.StringNumericLiteral) => string +> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >10n : 10n > : ^^^ >1000n : 1000n @@ -204,8 +204,8 @@ new Intl.NumberFormat('en-GB').formatRangeToParts(10, 1000)[0]; > : ^^^^^^^^^^^^^^^^^^^^^^^^^^ >new Intl.NumberFormat('en-GB').formatRangeToParts(10, 1000) : Intl.NumberRangeFormatPart[] > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->new Intl.NumberFormat('en-GB').formatRangeToParts : (start: number | bigint, end: number | bigint) => Intl.NumberRangeFormatPart[] -> : ^ ^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>new Intl.NumberFormat('en-GB').formatRangeToParts : (start: number | bigint | Intl.StringNumericLiteral, end: number | bigint | Intl.StringNumericLiteral) => Intl.NumberRangeFormatPart[] +> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >new Intl.NumberFormat('en-GB') : Intl.NumberFormat > : ^^^^^^^^^^^^^^^^^ >Intl.NumberFormat : Intl.NumberFormatConstructor @@ -216,8 +216,8 @@ new Intl.NumberFormat('en-GB').formatRangeToParts(10, 1000)[0]; > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >'en-GB' : "en-GB" > : ^^^^^^^ ->formatRangeToParts : (start: number | bigint, end: number | bigint) => Intl.NumberRangeFormatPart[] -> : ^ ^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>formatRangeToParts : (start: number | bigint | Intl.StringNumericLiteral, end: number | bigint | Intl.StringNumericLiteral) => Intl.NumberRangeFormatPart[] +> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >10 : 10 > : ^^ >1000 : 1000 @@ -230,8 +230,8 @@ new Intl.NumberFormat('en-GB').formatRangeToParts(10n, 1000n)[0]; > : ^^^^^^^^^^^^^^^^^^^^^^^^^^ >new Intl.NumberFormat('en-GB').formatRangeToParts(10n, 1000n) : Intl.NumberRangeFormatPart[] > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->new Intl.NumberFormat('en-GB').formatRangeToParts : (start: number | bigint, end: number | bigint) => Intl.NumberRangeFormatPart[] -> : ^ ^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>new Intl.NumberFormat('en-GB').formatRangeToParts : (start: number | bigint | Intl.StringNumericLiteral, end: number | bigint | Intl.StringNumericLiteral) => Intl.NumberRangeFormatPart[] +> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >new Intl.NumberFormat('en-GB') : Intl.NumberFormat > : ^^^^^^^^^^^^^^^^^ >Intl.NumberFormat : Intl.NumberFormatConstructor @@ -242,8 +242,8 @@ new Intl.NumberFormat('en-GB').formatRangeToParts(10n, 1000n)[0]; > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >'en-GB' : "en-GB" > : ^^^^^^^ ->formatRangeToParts : (start: number | bigint, end: number | bigint) => Intl.NumberRangeFormatPart[] -> : ^ ^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>formatRangeToParts : (start: number | bigint | Intl.StringNumericLiteral, end: number | bigint | Intl.StringNumericLiteral) => Intl.NumberRangeFormatPart[] +> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >10n : 10n > : ^^^ >1000n : 1000n @@ -251,3 +251,128 @@ new Intl.NumberFormat('en-GB').formatRangeToParts(10n, 1000n)[0]; >0 : 0 > : ^ +// Arbitrary-precision string arguments +new Intl.NumberFormat('en-GB').format('-12.3E-4'); +>new Intl.NumberFormat('en-GB').format('-12.3E-4') : string +> : ^^^^^^ +>new Intl.NumberFormat('en-GB').format : { (value: number): string; (value: number | bigint): string; (value: number | bigint | Intl.StringNumericLiteral): string; } +> : ^^^ ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>new Intl.NumberFormat('en-GB') : Intl.NumberFormat +> : ^^^^^^^^^^^^^^^^^ +>Intl.NumberFormat : Intl.NumberFormatConstructor +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>Intl : typeof Intl +> : ^^^^^^^^^^^ +>NumberFormat : Intl.NumberFormatConstructor +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>'en-GB' : "en-GB" +> : ^^^^^^^ +>format : { (value: number): string; (value: number | bigint): string; (value: number | bigint | Intl.StringNumericLiteral): string; } +> : ^^^ ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>'-12.3E-4' : "-12.3E-4" +> : ^^^^^^^^^^ + +new Intl.NumberFormat('en-GB').formatRange('123.4', '567.8'); +>new Intl.NumberFormat('en-GB').formatRange('123.4', '567.8') : string +> : ^^^^^^ +>new Intl.NumberFormat('en-GB').formatRange : (start: number | bigint | Intl.StringNumericLiteral, end: number | bigint | Intl.StringNumericLiteral) => string +> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>new Intl.NumberFormat('en-GB') : Intl.NumberFormat +> : ^^^^^^^^^^^^^^^^^ +>Intl.NumberFormat : Intl.NumberFormatConstructor +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>Intl : typeof Intl +> : ^^^^^^^^^^^ +>NumberFormat : Intl.NumberFormatConstructor +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>'en-GB' : "en-GB" +> : ^^^^^^^ +>formatRange : (start: number | bigint | Intl.StringNumericLiteral, end: number | bigint | Intl.StringNumericLiteral) => string +> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>'123.4' : "123.4" +> : ^^^^^^^ +>'567.8' : "567.8" +> : ^^^^^^^ + +new Intl.NumberFormat('en-GB').formatRangeToParts('123E-4', '567E8'); +>new Intl.NumberFormat('en-GB').formatRangeToParts('123E-4', '567E8') : Intl.NumberRangeFormatPart[] +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>new Intl.NumberFormat('en-GB').formatRangeToParts : (start: number | bigint | Intl.StringNumericLiteral, end: number | bigint | Intl.StringNumericLiteral) => Intl.NumberRangeFormatPart[] +> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>new Intl.NumberFormat('en-GB') : Intl.NumberFormat +> : ^^^^^^^^^^^^^^^^^ +>Intl.NumberFormat : Intl.NumberFormatConstructor +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>Intl : typeof Intl +> : ^^^^^^^^^^^ +>NumberFormat : Intl.NumberFormatConstructor +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>'en-GB' : "en-GB" +> : ^^^^^^^ +>formatRangeToParts : (start: number | bigint | Intl.StringNumericLiteral, end: number | bigint | Intl.StringNumericLiteral) => Intl.NumberRangeFormatPart[] +> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>'123E-4' : "123E-4" +> : ^^^^^^^^ +>'567E8' : "567E8" +> : ^^^^^^^ + +new Intl.NumberFormat('en-GB').format('Infinity'); +>new Intl.NumberFormat('en-GB').format('Infinity') : string +> : ^^^^^^ +>new Intl.NumberFormat('en-GB').format : { (value: number): string; (value: number | bigint): string; (value: number | bigint | Intl.StringNumericLiteral): string; } +> : ^^^ ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>new Intl.NumberFormat('en-GB') : Intl.NumberFormat +> : ^^^^^^^^^^^^^^^^^ +>Intl.NumberFormat : Intl.NumberFormatConstructor +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>Intl : typeof Intl +> : ^^^^^^^^^^^ +>NumberFormat : Intl.NumberFormatConstructor +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>'en-GB' : "en-GB" +> : ^^^^^^^ +>format : { (value: number): string; (value: number | bigint): string; (value: number | bigint | Intl.StringNumericLiteral): string; } +> : ^^^ ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>'Infinity' : "Infinity" +> : ^^^^^^^^^^ + +new Intl.NumberFormat('en-GB').format('-Infinity'); +>new Intl.NumberFormat('en-GB').format('-Infinity') : string +> : ^^^^^^ +>new Intl.NumberFormat('en-GB').format : { (value: number): string; (value: number | bigint): string; (value: number | bigint | Intl.StringNumericLiteral): string; } +> : ^^^ ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>new Intl.NumberFormat('en-GB') : Intl.NumberFormat +> : ^^^^^^^^^^^^^^^^^ +>Intl.NumberFormat : Intl.NumberFormatConstructor +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>Intl : typeof Intl +> : ^^^^^^^^^^^ +>NumberFormat : Intl.NumberFormatConstructor +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>'en-GB' : "en-GB" +> : ^^^^^^^ +>format : { (value: number): string; (value: number | bigint): string; (value: number | bigint | Intl.StringNumericLiteral): string; } +> : ^^^ ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>'-Infinity' : "-Infinity" +> : ^^^^^^^^^^^ + +new Intl.NumberFormat('en-GB').format('+Infinity'); +>new Intl.NumberFormat('en-GB').format('+Infinity') : string +> : ^^^^^^ +>new Intl.NumberFormat('en-GB').format : { (value: number): string; (value: number | bigint): string; (value: number | bigint | Intl.StringNumericLiteral): string; } +> : ^^^ ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>new Intl.NumberFormat('en-GB') : Intl.NumberFormat +> : ^^^^^^^^^^^^^^^^^ +>Intl.NumberFormat : Intl.NumberFormatConstructor +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>Intl : typeof Intl +> : ^^^^^^^^^^^ +>NumberFormat : Intl.NumberFormatConstructor +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>'en-GB' : "en-GB" +> : ^^^^^^^ +>format : { (value: number): string; (value: number | bigint): string; (value: number | bigint | Intl.StringNumericLiteral): string; } +> : ^^^ ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>'+Infinity' : "+Infinity" +> : ^^^^^^^^^^^ + diff --git a/tests/cases/conformance/es2023/intlNumberFormatES2023.ts b/tests/cases/conformance/es2023/intlNumberFormatES2023.ts index a84b985e41cfa..1255f41968994 100644 --- a/tests/cases/conformance/es2023/intlNumberFormatES2023.ts +++ b/tests/cases/conformance/es2023/intlNumberFormatES2023.ts @@ -24,3 +24,11 @@ new Intl.NumberFormat('en-GB').formatRange(10, 100); new Intl.NumberFormat('en-GB').formatRange(10n, 1000n); new Intl.NumberFormat('en-GB').formatRangeToParts(10, 1000)[0]; new Intl.NumberFormat('en-GB').formatRangeToParts(10n, 1000n)[0]; + +// Arbitrary-precision string arguments +new Intl.NumberFormat('en-GB').format('-12.3E-4'); +new Intl.NumberFormat('en-GB').formatRange('123.4', '567.8'); +new Intl.NumberFormat('en-GB').formatRangeToParts('123E-4', '567E8'); +new Intl.NumberFormat('en-GB').format('Infinity'); +new Intl.NumberFormat('en-GB').format('-Infinity'); +new Intl.NumberFormat('en-GB').format('+Infinity');