Skip to content

Commit 48ad25d

Browse files
Add currency sign to NumberFormatOptions type (#40709)
1 parent 3766be1 commit 48ad25d

File tree

5 files changed

+40
-0
lines changed

5 files changed

+40
-0
lines changed

src/lib/es5.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4284,6 +4284,7 @@ declare namespace Intl {
42844284
style?: string;
42854285
currency?: string;
42864286
currencyDisplay?: string;
4287+
currencySign?: string;
42874288
useGrouping?: boolean;
42884289
minimumIntegerDigits?: number;
42894290
minimumFractionDigits?: number;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
//// [numberFormatCurrencySign.ts]
2+
const str = new Intl.NumberFormat('en-NZ', { style: 'currency', currency: 'NZD', currencySign: 'accounting' }).format(999999);
3+
4+
5+
//// [numberFormatCurrencySign.js]
6+
var str = new Intl.NumberFormat('en-NZ', { style: 'currency', currency: 'NZD', currencySign: 'accounting' }).format(999999);
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
=== tests/cases/compiler/numberFormatCurrencySign.ts ===
2+
const str = new Intl.NumberFormat('en-NZ', { style: 'currency', currency: 'NZD', currencySign: 'accounting' }).format(999999);
3+
>str : Symbol(str, Decl(numberFormatCurrencySign.ts, 0, 5))
4+
>new Intl.NumberFormat('en-NZ', { style: 'currency', currency: 'NZD', currencySign: 'accounting' }).format : Symbol(Intl.NumberFormat.format, Decl(lib.es5.d.ts, --, --))
5+
>Intl.NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
6+
>Intl : Symbol(Intl, Decl(lib.es5.d.ts, --, --))
7+
>NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
8+
>style : Symbol(style, Decl(numberFormatCurrencySign.ts, 0, 44))
9+
>currency : Symbol(currency, Decl(numberFormatCurrencySign.ts, 0, 63))
10+
>currencySign : Symbol(currencySign, Decl(numberFormatCurrencySign.ts, 0, 80))
11+
>format : Symbol(Intl.NumberFormat.format, Decl(lib.es5.d.ts, --, --))
12+
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
=== tests/cases/compiler/numberFormatCurrencySign.ts ===
2+
const str = new Intl.NumberFormat('en-NZ', { style: 'currency', currency: 'NZD', currencySign: 'accounting' }).format(999999);
3+
>str : string
4+
>new Intl.NumberFormat('en-NZ', { style: 'currency', currency: 'NZD', currencySign: 'accounting' }).format(999999) : string
5+
>new Intl.NumberFormat('en-NZ', { style: 'currency', currency: 'NZD', currencySign: 'accounting' }).format : (value: number) => string
6+
>new Intl.NumberFormat('en-NZ', { style: 'currency', currency: 'NZD', currencySign: 'accounting' }) : Intl.NumberFormat
7+
>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[]; }
8+
>Intl : typeof Intl
9+
>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[]; }
10+
>'en-NZ' : "en-NZ"
11+
>{ style: 'currency', currency: 'NZD', currencySign: 'accounting' } : { style: string; currency: string; currencySign: string; }
12+
>style : string
13+
>'currency' : "currency"
14+
>currency : string
15+
>'NZD' : "NZD"
16+
>currencySign : string
17+
>'accounting' : "accounting"
18+
>format : (value: number) => string
19+
>999999 : 999999
20+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
const str = new Intl.NumberFormat('en-NZ', { style: 'currency', currency: 'NZD', currencySign: 'accounting' }).format(999999);

0 commit comments

Comments
 (0)