From 7366eb2a81a7cc085af996cad06f91b3bb7dd2e8 Mon Sep 17 00:00:00 2001 From: Rob Snow Date: Fri, 7 May 2021 17:56:04 -0700 Subject: [PATCH 1/4] Add missing currencyDisplay to resolved number format options --- src/lib/es5.d.ts | 1 + .../numberFormatCurrencySignResolved.js | 8 ++++++ .../numberFormatCurrencySignResolved.symbols | 18 +++++++++++++ .../numberFormatCurrencySignResolved.types | 25 +++++++++++++++++++ .../numberFormatCurrencySignResolved.ts | 2 ++ 5 files changed, 54 insertions(+) create mode 100644 tests/baselines/reference/numberFormatCurrencySignResolved.js create mode 100644 tests/baselines/reference/numberFormatCurrencySignResolved.symbols create mode 100644 tests/baselines/reference/numberFormatCurrencySignResolved.types create mode 100644 tests/cases/compiler/numberFormatCurrencySignResolved.ts diff --git a/src/lib/es5.d.ts b/src/lib/es5.d.ts index bfa5241a84d94..c2fb5427abd2d 100644 --- a/src/lib/es5.d.ts +++ b/src/lib/es5.d.ts @@ -4311,6 +4311,7 @@ declare namespace Intl { style: string; currency?: string; currencyDisplay?: string; + currencySign?: string; minimumIntegerDigits: number; minimumFractionDigits: number; maximumFractionDigits: number; diff --git a/tests/baselines/reference/numberFormatCurrencySignResolved.js b/tests/baselines/reference/numberFormatCurrencySignResolved.js new file mode 100644 index 0000000000000..b473b9fc5e15f --- /dev/null +++ b/tests/baselines/reference/numberFormatCurrencySignResolved.js @@ -0,0 +1,8 @@ +//// [numberFormatCurrencySignResolved.ts] +const options = new Intl.NumberFormat('en-NZ', { style: 'currency', currency: 'NZD', currencySign: 'accounting' }).resolvedOptions(); +const currencySign = options.currencySign; + + +//// [numberFormatCurrencySignResolved.js] +var options = new Intl.NumberFormat('en-NZ', { style: 'currency', currency: 'NZD', currencySign: 'accounting' }).resolvedOptions(); +var currencySign = options.currencySign; diff --git a/tests/baselines/reference/numberFormatCurrencySignResolved.symbols b/tests/baselines/reference/numberFormatCurrencySignResolved.symbols new file mode 100644 index 0000000000000..3df544ef4ebb0 --- /dev/null +++ b/tests/baselines/reference/numberFormatCurrencySignResolved.symbols @@ -0,0 +1,18 @@ +=== tests/cases/compiler/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, --, --)) +>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, --, --)) +>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, --, --)) + +const currencySign = options.currencySign; +>currencySign : Symbol(currencySign, Decl(numberFormatCurrencySignResolved.ts, 1, 5)) +>options.currencySign : Symbol(Intl.ResolvedNumberFormatOptions.currencySign, Decl(lib.es5.d.ts, --, --)) +>options : Symbol(options, Decl(numberFormatCurrencySignResolved.ts, 0, 5)) +>currencySign : Symbol(Intl.ResolvedNumberFormatOptions.currencySign, Decl(lib.es5.d.ts, --, --)) + diff --git a/tests/baselines/reference/numberFormatCurrencySignResolved.types b/tests/baselines/reference/numberFormatCurrencySignResolved.types new file mode 100644 index 0000000000000..1b8e997471bb7 --- /dev/null +++ b/tests/baselines/reference/numberFormatCurrencySignResolved.types @@ -0,0 +1,25 @@ +=== tests/cases/compiler/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 +>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 : 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-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 + +const currencySign = options.currencySign; +>currencySign : string +>options.currencySign : string +>options : Intl.ResolvedNumberFormatOptions +>currencySign : string + diff --git a/tests/cases/compiler/numberFormatCurrencySignResolved.ts b/tests/cases/compiler/numberFormatCurrencySignResolved.ts new file mode 100644 index 0000000000000..1f12187817770 --- /dev/null +++ b/tests/cases/compiler/numberFormatCurrencySignResolved.ts @@ -0,0 +1,2 @@ +const options = new Intl.NumberFormat('en-NZ', { style: 'currency', currency: 'NZD', currencySign: 'accounting' }).resolvedOptions(); +const currencySign = options.currencySign; From bc2ca52d9d9b5acba767326863d6ee47070ac3d8 Mon Sep 17 00:00:00 2001 From: Rob Snow Date: Mon, 10 May 2021 10:29:35 -0700 Subject: [PATCH 2/4] Move declaration to es2020 --- src/lib/es2020.intl.d.ts | 4 ++++ src/lib/es5.d.ts | 4 ---- .../reference/numberFormatCurrencySign.js | 3 ++- .../reference/numberFormatCurrencySign.symbols | 12 ++++++------ .../reference/numberFormatCurrencySign.types | 10 +++++----- .../numberFormatCurrencySignResolved.js | 5 +++-- .../numberFormatCurrencySignResolved.symbols | 16 ++++++++-------- .../numberFormatCurrencySignResolved.types | 16 ++++++++-------- .../es2020}/numberFormatCurrencySign.ts | 3 +++ .../es2020}/numberFormatCurrencySignResolved.ts | 3 +++ 10 files changed, 42 insertions(+), 34 deletions(-) rename tests/cases/{compiler => conformance/es2020}/numberFormatCurrencySign.ts (70%) rename tests/cases/{compiler => conformance/es2020}/numberFormatCurrencySignResolved.ts (77%) diff --git a/src/lib/es2020.intl.d.ts b/src/lib/es2020.intl.d.ts index cf75a593f2a0e..5536758680fc2 100644 --- a/src/lib/es2020.intl.d.ts +++ b/src/lib/es2020.intl.d.ts @@ -267,6 +267,8 @@ declare namespace Intl { signDisplay?: string; unit?: string; unitDisplay?: string; + currencyDisplay?: string; + currencySign?: string; } interface ResolvedNumberFormatOptions { @@ -275,6 +277,8 @@ declare namespace Intl { signDisplay?: string; unit?: string; unitDisplay?: string; + currencyDisplay?: string; + currencySign?: string; } interface DateTimeFormatOptions { diff --git a/src/lib/es5.d.ts b/src/lib/es5.d.ts index c2fb5427abd2d..559a2ee0a6388 100644 --- a/src/lib/es5.d.ts +++ b/src/lib/es5.d.ts @@ -4295,8 +4295,6 @@ declare namespace Intl { localeMatcher?: string; style?: string; currency?: string; - currencyDisplay?: string; - currencySign?: string; useGrouping?: boolean; minimumIntegerDigits?: number; minimumFractionDigits?: number; @@ -4310,8 +4308,6 @@ declare namespace Intl { numberingSystem: string; style: string; currency?: string; - currencyDisplay?: string; - currencySign?: 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..180b28cd728e1 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.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, --, --)) >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 index b473b9fc5e15f..1a225275a3c02 100644 --- a/tests/baselines/reference/numberFormatCurrencySignResolved.js +++ b/tests/baselines/reference/numberFormatCurrencySignResolved.js @@ -4,5 +4,6 @@ const currencySign = options.currencySign; //// [numberFormatCurrencySignResolved.js] -var options = new Intl.NumberFormat('en-NZ', { style: 'currency', currency: 'NZD', currencySign: 'accounting' }).resolvedOptions(); -var currencySign = options.currencySign; +"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 index 3df544ef4ebb0..4f6e34086dbc2 100644 --- a/tests/baselines/reference/numberFormatCurrencySignResolved.symbols +++ b/tests/baselines/reference/numberFormatCurrencySignResolved.symbols @@ -1,18 +1,18 @@ -=== tests/cases/compiler/numberFormatCurrencySignResolved.ts === +=== 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, --, --)) ->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' }).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.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, --, --)) >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, --, --)) +>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.es5.d.ts, --, --)) +>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.es5.d.ts, --, --)) +>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 index 1b8e997471bb7..b777f8949689f 100644 --- a/tests/baselines/reference/numberFormatCurrencySignResolved.types +++ b/tests/baselines/reference/numberFormatCurrencySignResolved.types @@ -1,12 +1,12 @@ -=== tests/cases/compiler/numberFormatCurrencySignResolved.ts === +=== 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 +>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[], 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,11 +15,11 @@ const options = new Intl.NumberFormat('en-NZ', { style: 'currency', currency: 'N >'NZD' : "NZD" >currencySign : string >'accounting' : "accounting" ->resolvedOptions : () => Intl.ResolvedNumberFormatOptions +>resolvedOptions : { (): Intl.ResolvedNumberFormatOptions; (): Intl.ResolvedNumberFormatOptions; } const currencySign = options.currencySign; ->currencySign : string ->options.currencySign : string +>currencySign : string | undefined +>options.currencySign : string | undefined >options : Intl.ResolvedNumberFormatOptions ->currencySign : string +>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/compiler/numberFormatCurrencySignResolved.ts b/tests/cases/conformance/es2020/numberFormatCurrencySignResolved.ts similarity index 77% rename from tests/cases/compiler/numberFormatCurrencySignResolved.ts rename to tests/cases/conformance/es2020/numberFormatCurrencySignResolved.ts index 1f12187817770..ce6c36fb19fe1 100644 --- a/tests/cases/compiler/numberFormatCurrencySignResolved.ts +++ b/tests/cases/conformance/es2020/numberFormatCurrencySignResolved.ts @@ -1,2 +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; From e7d160e455ab27ece36a7cbf62572e37fe6ea68b Mon Sep 17 00:00:00 2001 From: Orta Therox Date: Wed, 8 Sep 2021 11:18:40 +0100 Subject: [PATCH 3/4] Update es2020.intl.d.ts --- src/lib/es2020.intl.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib/es2020.intl.d.ts b/src/lib/es2020.intl.d.ts index ec0af5c3e86ea..e804ce7f98b4d 100644 --- a/src/lib/es2020.intl.d.ts +++ b/src/lib/es2020.intl.d.ts @@ -218,6 +218,8 @@ declare namespace Intl { signDisplay?: "auto" | "never" | "always"; unit?: NumberFormatUnit; unitDisplay?: "short" | "long" | "narrow"; + currencyDisplay?: string; + currencySign?: string; } interface DateTimeFormatOptions { From 4ede453dc33162c8b017411c5fa1a01e979e4a7c Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Tue, 18 Jan 2022 13:29:23 -0800 Subject: [PATCH 4/4] Fix bad merge --- src/lib/es5.d.ts | 1 + tests/baselines/reference/numberFormatCurrencySign.symbols | 6 +++--- .../reference/numberFormatCurrencySignResolved.symbols | 6 +++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/lib/es5.d.ts b/src/lib/es5.d.ts index 586bf3a05d01c..1cd4cdd7412d2 100644 --- a/src/lib/es5.d.ts +++ b/src/lib/es5.d.ts @@ -4354,6 +4354,7 @@ declare namespace Intl { interface NumberFormatOptions { localeMatcher?: string | undefined; style?: string | undefined; + currency?: string | undefined; currencySign?: string | undefined; useGrouping?: boolean | undefined; minimumIntegerDigits?: number | undefined; diff --git a/tests/baselines/reference/numberFormatCurrencySign.symbols b/tests/baselines/reference/numberFormatCurrencySign.symbols index 180b28cd728e1..2049480e3c18a 100644 --- a/tests/baselines/reference/numberFormatCurrencySign.symbols +++ b/tests/baselines/reference/numberFormatCurrencySign.symbols @@ -2,9 +2,9 @@ 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, --, --), 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, --, --), 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, --, --)) +>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)) diff --git a/tests/baselines/reference/numberFormatCurrencySignResolved.symbols b/tests/baselines/reference/numberFormatCurrencySignResolved.symbols index 4f6e34086dbc2..d73d3d91dc52f 100644 --- a/tests/baselines/reference/numberFormatCurrencySignResolved.symbols +++ b/tests/baselines/reference/numberFormatCurrencySignResolved.symbols @@ -2,9 +2,9 @@ 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.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, --, --)) +>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))