diff --git a/src/lib/es2020.intl.d.ts b/src/lib/es2020.intl.d.ts index 92e353b913f6a..2ab4531283a77 100644 --- a/src/lib/es2020.intl.d.ts +++ b/src/lib/es2020.intl.d.ts @@ -203,6 +203,8 @@ declare namespace Intl { signDisplay?: "auto" | "never" | "always" | "exceptZero" | undefined; unit?: string | undefined; unitDisplay?: "short" | "long" | "narrow" | undefined; + currencyDisplay?: string | undefined; + currencySign?: string | undefined; } interface ResolvedNumberFormatOptions { @@ -211,6 +213,8 @@ declare namespace Intl { signDisplay?: "auto" | "never" | "always" | "exceptZero"; unit?: string; unitDisplay?: "short" | "long" | "narrow"; + currencyDisplay?: string; + currencySign?: string; } interface DateTimeFormatOptions { diff --git a/src/lib/es5.d.ts b/src/lib/es5.d.ts index 4e17715a993bf..1cd4cdd7412d2 100644 --- a/src/lib/es5.d.ts +++ b/src/lib/es5.d.ts @@ -4355,7 +4355,6 @@ declare namespace Intl { localeMatcher?: string | undefined; style?: string | undefined; currency?: string | undefined; - currencyDisplay?: string | undefined; currencySign?: string | undefined; useGrouping?: boolean | undefined; minimumIntegerDigits?: number | undefined; @@ -4370,7 +4369,6 @@ declare namespace Intl { numberingSystem: string; style: string; currency?: string; - currencyDisplay?: string; minimumIntegerDigits: number; minimumFractionDigits: number; maximumFractionDigits: number; diff --git a/tests/baselines/reference/numberFormatCurrencySign.js b/tests/baselines/reference/numberFormatCurrencySign.js index 9f2482e2bffdc..d4d844d6b7f9b 100644 --- a/tests/baselines/reference/numberFormatCurrencySign.js +++ b/tests/baselines/reference/numberFormatCurrencySign.js @@ -3,4 +3,5 @@ const str = new Intl.NumberFormat('en-NZ', { style: 'currency', currency: 'NZD', //// [numberFormatCurrencySign.js] -var str = new Intl.NumberFormat('en-NZ', { style: 'currency', currency: 'NZD', currencySign: 'accounting' }).format(999999); +"use strict"; +const str = new Intl.NumberFormat('en-NZ', { style: 'currency', currency: 'NZD', currencySign: 'accounting' }).format(999999); diff --git a/tests/baselines/reference/numberFormatCurrencySign.symbols b/tests/baselines/reference/numberFormatCurrencySign.symbols index 3252448682c91..2049480e3c18a 100644 --- a/tests/baselines/reference/numberFormatCurrencySign.symbols +++ b/tests/baselines/reference/numberFormatCurrencySign.symbols @@ -1,12 +1,12 @@ -=== tests/cases/compiler/numberFormatCurrencySign.ts === +=== tests/cases/conformance/es2020/numberFormatCurrencySign.ts === const str = new Intl.NumberFormat('en-NZ', { style: 'currency', currency: 'NZD', currencySign: 'accounting' }).format(999999); >str : Symbol(str, Decl(numberFormatCurrencySign.ts, 0, 5)) ->new Intl.NumberFormat('en-NZ', { style: 'currency', currency: 'NZD', currencySign: 'accounting' }).format : Symbol(Intl.NumberFormat.format, Decl(lib.es5.d.ts, --, --)) ->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, --, --)) +>new Intl.NumberFormat('en-NZ', { style: 'currency', currency: 'NZD', currencySign: 'accounting' }).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.es2018.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2021.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 2 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.es2021.intl.d.ts, --, --)) >style : Symbol(style, Decl(numberFormatCurrencySign.ts, 0, 44)) >currency : Symbol(currency, Decl(numberFormatCurrencySign.ts, 0, 63)) >currencySign : Symbol(currencySign, Decl(numberFormatCurrencySign.ts, 0, 80)) ->format : Symbol(Intl.NumberFormat.format, Decl(lib.es5.d.ts, --, --)) +>format : Symbol(Intl.NumberFormat.format, Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --)) diff --git a/tests/baselines/reference/numberFormatCurrencySign.types b/tests/baselines/reference/numberFormatCurrencySign.types index 343951cb8e943..7b88d597715a9 100644 --- a/tests/baselines/reference/numberFormatCurrencySign.types +++ b/tests/baselines/reference/numberFormatCurrencySign.types @@ -1,12 +1,12 @@ -=== tests/cases/compiler/numberFormatCurrencySign.ts === +=== tests/cases/conformance/es2020/numberFormatCurrencySign.ts === const str = new Intl.NumberFormat('en-NZ', { style: 'currency', currency: 'NZD', currencySign: 'accounting' }).format(999999); >str : string >new Intl.NumberFormat('en-NZ', { style: 'currency', currency: 'NZD', currencySign: 'accounting' }).format(999999) : string ->new Intl.NumberFormat('en-NZ', { style: 'currency', currency: 'NZD', currencySign: 'accounting' }).format : (value: number) => string +>new Intl.NumberFormat('en-NZ', { style: 'currency', currency: 'NZD', currencySign: 'accounting' }).format : { (value: number): string; (value: number | bigint): string; } >new Intl.NumberFormat('en-NZ', { style: 'currency', currency: 'NZD', currencySign: 'accounting' }) : 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.NumberFormat : { (locales?: string | string[] | undefined, options?: Intl.NumberFormatOptions | undefined): Intl.NumberFormat; new (locales?: string | string[] | undefined, options?: Intl.NumberFormatOptions | undefined): Intl.NumberFormat; supportedLocalesOf(locales: string | string[], options?: Intl.NumberFormatOptions | undefined): 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[]; } +>NumberFormat : { (locales?: string | string[] | undefined, options?: Intl.NumberFormatOptions | undefined): Intl.NumberFormat; new (locales?: string | string[] | undefined, options?: Intl.NumberFormatOptions | undefined): Intl.NumberFormat; supportedLocalesOf(locales: string | string[], options?: Intl.NumberFormatOptions | undefined): string[]; } >'en-NZ' : "en-NZ" >{ style: 'currency', currency: 'NZD', currencySign: 'accounting' } : { style: string; currency: string; currencySign: string; } >style : string @@ -15,6 +15,6 @@ const str = new Intl.NumberFormat('en-NZ', { style: 'currency', currency: 'NZD', >'NZD' : "NZD" >currencySign : string >'accounting' : "accounting" ->format : (value: number) => string +>format : { (value: number): string; (value: number | bigint): string; } >999999 : 999999 diff --git a/tests/baselines/reference/numberFormatCurrencySignResolved.js b/tests/baselines/reference/numberFormatCurrencySignResolved.js new file mode 100644 index 0000000000000..1a225275a3c02 --- /dev/null +++ b/tests/baselines/reference/numberFormatCurrencySignResolved.js @@ -0,0 +1,9 @@ +//// [numberFormatCurrencySignResolved.ts] +const options = new Intl.NumberFormat('en-NZ', { style: 'currency', currency: 'NZD', currencySign: 'accounting' }).resolvedOptions(); +const currencySign = options.currencySign; + + +//// [numberFormatCurrencySignResolved.js] +"use strict"; +const options = new Intl.NumberFormat('en-NZ', { style: 'currency', currency: 'NZD', currencySign: 'accounting' }).resolvedOptions(); +const currencySign = options.currencySign; diff --git a/tests/baselines/reference/numberFormatCurrencySignResolved.symbols b/tests/baselines/reference/numberFormatCurrencySignResolved.symbols new file mode 100644 index 0000000000000..d73d3d91dc52f --- /dev/null +++ b/tests/baselines/reference/numberFormatCurrencySignResolved.symbols @@ -0,0 +1,18 @@ +=== tests/cases/conformance/es2020/numberFormatCurrencySignResolved.ts === +const options = new Intl.NumberFormat('en-NZ', { style: 'currency', currency: 'NZD', currencySign: 'accounting' }).resolvedOptions(); +>options : Symbol(options, Decl(numberFormatCurrencySignResolved.ts, 0, 5)) +>new Intl.NumberFormat('en-NZ', { style: 'currency', currency: 'NZD', currencySign: 'accounting' }).resolvedOptions : Symbol(Intl.NumberFormat.resolvedOptions, 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, --, --), Decl(lib.es2021.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 2 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.es2021.intl.d.ts, --, --)) +>style : Symbol(style, Decl(numberFormatCurrencySignResolved.ts, 0, 48)) +>currency : Symbol(currency, Decl(numberFormatCurrencySignResolved.ts, 0, 67)) +>currencySign : Symbol(currencySign, Decl(numberFormatCurrencySignResolved.ts, 0, 84)) +>resolvedOptions : Symbol(Intl.NumberFormat.resolvedOptions, Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --)) + +const currencySign = options.currencySign; +>currencySign : Symbol(currencySign, Decl(numberFormatCurrencySignResolved.ts, 1, 5)) +>options.currencySign : Symbol(Intl.ResolvedNumberFormatOptions.currencySign, Decl(lib.es2020.intl.d.ts, --, --)) +>options : Symbol(options, Decl(numberFormatCurrencySignResolved.ts, 0, 5)) +>currencySign : Symbol(Intl.ResolvedNumberFormatOptions.currencySign, Decl(lib.es2020.intl.d.ts, --, --)) + diff --git a/tests/baselines/reference/numberFormatCurrencySignResolved.types b/tests/baselines/reference/numberFormatCurrencySignResolved.types new file mode 100644 index 0000000000000..b777f8949689f --- /dev/null +++ b/tests/baselines/reference/numberFormatCurrencySignResolved.types @@ -0,0 +1,25 @@ +=== tests/cases/conformance/es2020/numberFormatCurrencySignResolved.ts === +const options = new Intl.NumberFormat('en-NZ', { style: 'currency', currency: 'NZD', currencySign: 'accounting' }).resolvedOptions(); +>options : Intl.ResolvedNumberFormatOptions +>new Intl.NumberFormat('en-NZ', { style: 'currency', currency: 'NZD', currencySign: 'accounting' }).resolvedOptions() : Intl.ResolvedNumberFormatOptions +>new Intl.NumberFormat('en-NZ', { style: 'currency', currency: 'NZD', currencySign: 'accounting' }).resolvedOptions : { (): Intl.ResolvedNumberFormatOptions; (): Intl.ResolvedNumberFormatOptions; } +>new Intl.NumberFormat('en-NZ', { style: 'currency', currency: 'NZD', currencySign: 'accounting' }) : Intl.NumberFormat +>Intl.NumberFormat : { (locales?: string | string[] | undefined, options?: Intl.NumberFormatOptions | undefined): Intl.NumberFormat; new (locales?: string | string[] | undefined, options?: Intl.NumberFormatOptions | undefined): Intl.NumberFormat; supportedLocalesOf(locales: string | string[], options?: Intl.NumberFormatOptions | undefined): string[]; } +>Intl : typeof Intl +>NumberFormat : { (locales?: string | string[] | undefined, options?: Intl.NumberFormatOptions | undefined): Intl.NumberFormat; new (locales?: string | string[] | undefined, options?: Intl.NumberFormatOptions | undefined): Intl.NumberFormat; supportedLocalesOf(locales: string | string[], options?: Intl.NumberFormatOptions | undefined): string[]; } +>'en-NZ' : "en-NZ" +>{ style: 'currency', currency: 'NZD', currencySign: 'accounting' } : { style: string; currency: string; currencySign: string; } +>style : string +>'currency' : "currency" +>currency : string +>'NZD' : "NZD" +>currencySign : string +>'accounting' : "accounting" +>resolvedOptions : { (): Intl.ResolvedNumberFormatOptions; (): Intl.ResolvedNumberFormatOptions; } + +const currencySign = options.currencySign; +>currencySign : string | undefined +>options.currencySign : string | undefined +>options : Intl.ResolvedNumberFormatOptions +>currencySign : string | undefined + diff --git a/tests/cases/compiler/numberFormatCurrencySign.ts b/tests/cases/conformance/es2020/numberFormatCurrencySign.ts similarity index 70% rename from tests/cases/compiler/numberFormatCurrencySign.ts rename to tests/cases/conformance/es2020/numberFormatCurrencySign.ts index ee70de4a9b7ec..b7b451150d09d 100644 --- a/tests/cases/compiler/numberFormatCurrencySign.ts +++ b/tests/cases/conformance/es2020/numberFormatCurrencySign.ts @@ -1 +1,4 @@ +// @target: esnext +// @lib: esnext +// @strict: true const str = new Intl.NumberFormat('en-NZ', { style: 'currency', currency: 'NZD', currencySign: 'accounting' }).format(999999); diff --git a/tests/cases/conformance/es2020/numberFormatCurrencySignResolved.ts b/tests/cases/conformance/es2020/numberFormatCurrencySignResolved.ts new file mode 100644 index 0000000000000..ce6c36fb19fe1 --- /dev/null +++ b/tests/cases/conformance/es2020/numberFormatCurrencySignResolved.ts @@ -0,0 +1,5 @@ +// @target: esnext +// @lib: esnext +// @strict: true +const options = new Intl.NumberFormat('en-NZ', { style: 'currency', currency: 'NZD', currencySign: 'accounting' }).resolvedOptions(); +const currencySign = options.currencySign;