mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-04 12:32:08 -06:00
Accept decimal strings in Intl.NumberFormat (#57595)
Co-authored-by: Renegade334 <contact.9a5d6388@renegade334.me.uk>
This commit is contained in:
parent
a2d37a5c60
commit
bdd1f947f6
8
src/lib/es2023.intl.d.ts
vendored
8
src/lib/es2023.intl.d.ts
vendored
@ -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[];
|
||||
}
|
||||
}
|
||||
|
||||
@ -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');
|
||||
|
||||
@ -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, --, --))
|
||||
|
||||
|
||||
@ -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"
|
||||
> : ^^^^^^^^^^^
|
||||
|
||||
|
||||
@ -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');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user