From 0883b5433a8037a6cdf887076aabe2828890f57e Mon Sep 17 00:00:00 2001 From: Khafra <42794878+KhafraDev@users.noreply.github.com> Date: Sun, 26 Mar 2023 11:36:09 -0400 Subject: [PATCH 1/4] add Intl.supportedValuesOf --- src/lib/es2022.intl.d.ts | 13 ++++++++++ tests/baselines/reference/es2022IntlAPIs.js | 9 +++++++ .../reference/es2022IntlAPIs.symbols | 16 +++++++++++++ .../baselines/reference/es2022IntlAPIs.types | 24 +++++++++++++++++++ .../conformance/es2022/es2022IntlAPIs.ts | 5 ++++ 5 files changed, 67 insertions(+) diff --git a/src/lib/es2022.intl.d.ts b/src/lib/es2022.intl.d.ts index 0672ec4d2d4d4..656c6b2d1f031 100644 --- a/src/lib/es2022.intl.d.ts +++ b/src/lib/es2022.intl.d.ts @@ -88,4 +88,17 @@ declare namespace Intl { */ supportedLocalesOf(locales: BCP47LanguageTag | BCP47LanguageTag[], options?: Pick): BCP47LanguageTag[]; }; + + type EnumerationKeys = "calendar" | "collation" | "currency" | "numberingSystem" | "timeZone" | "unit"; + + /** + * Returns a list of the supported collation, calendar, currency, numbering system, timezones, and units by the implementation. + * + * @param key A string indicating the category of values to return. + * + * @returns {string[]} A list of the supported values. + * + * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/supportedValuesOf) + */ + function supportedValuesOf(key: EnumerationKeys): string[]; } diff --git a/tests/baselines/reference/es2022IntlAPIs.js b/tests/baselines/reference/es2022IntlAPIs.js index 8611c0bf51524..32901521ed89b 100644 --- a/tests/baselines/reference/es2022IntlAPIs.js +++ b/tests/baselines/reference/es2022IntlAPIs.js @@ -7,6 +7,11 @@ for (const zoneName of timezoneNames) { timeZoneName: zoneName, }); } + +const enumerationKeys = ['calendar', 'collation', 'currency', 'numberingSystem', 'timeZone', 'unit'] as const; +for (const key of enumerationKeys) { + var supported = Intl.supportedValuesOf(key); +} //// [es2022IntlAPIs.js] @@ -18,3 +23,7 @@ for (const zoneName of timezoneNames) { timeZoneName: zoneName, }); } +const enumerationKeys = ['calendar', 'collation', 'currency', 'numberingSystem', 'timeZone', 'unit']; +for (const key of enumerationKeys) { + var supported = Intl.supportedValuesOf(key); +} diff --git a/tests/baselines/reference/es2022IntlAPIs.symbols b/tests/baselines/reference/es2022IntlAPIs.symbols index 60942707e9883..33bec6369ec64 100644 --- a/tests/baselines/reference/es2022IntlAPIs.symbols +++ b/tests/baselines/reference/es2022IntlAPIs.symbols @@ -24,3 +24,19 @@ for (const zoneName of timezoneNames) { }); } +const enumerationKeys = ['calendar', 'collation', 'currency', 'numberingSystem', 'timeZone', 'unit'] as const; +>enumerationKeys : Symbol(enumerationKeys, Decl(es2022IntlAPIs.ts, 9, 5)) +>const : Symbol(const) + +for (const key of enumerationKeys) { +>key : Symbol(key, Decl(es2022IntlAPIs.ts, 10, 10)) +>enumerationKeys : Symbol(enumerationKeys, Decl(es2022IntlAPIs.ts, 9, 5)) + + var supported = Intl.supportedValuesOf(key); +>supported : Symbol(supported, Decl(es2022IntlAPIs.ts, 11, 5)) +>Intl.supportedValuesOf : Symbol(Intl.supportedValuesOf, Decl(lib.es2022.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.es2019.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --) ... and 3 more) +>supportedValuesOf : Symbol(Intl.supportedValuesOf, Decl(lib.es2022.intl.d.ts, --, --)) +>key : Symbol(key, Decl(es2022IntlAPIs.ts, 10, 10)) +} + diff --git a/tests/baselines/reference/es2022IntlAPIs.types b/tests/baselines/reference/es2022IntlAPIs.types index d6a0ac5049eec..7a3af046f3e8e 100644 --- a/tests/baselines/reference/es2022IntlAPIs.types +++ b/tests/baselines/reference/es2022IntlAPIs.types @@ -35,3 +35,27 @@ for (const zoneName of timezoneNames) { }); } +const enumerationKeys = ['calendar', 'collation', 'currency', 'numberingSystem', 'timeZone', 'unit'] as const; +>enumerationKeys : readonly ["calendar", "collation", "currency", "numberingSystem", "timeZone", "unit"] +>['calendar', 'collation', 'currency', 'numberingSystem', 'timeZone', 'unit'] as const : readonly ["calendar", "collation", "currency", "numberingSystem", "timeZone", "unit"] +>['calendar', 'collation', 'currency', 'numberingSystem', 'timeZone', 'unit'] : readonly ["calendar", "collation", "currency", "numberingSystem", "timeZone", "unit"] +>'calendar' : "calendar" +>'collation' : "collation" +>'currency' : "currency" +>'numberingSystem' : "numberingSystem" +>'timeZone' : "timeZone" +>'unit' : "unit" + +for (const key of enumerationKeys) { +>key : "calendar" | "collation" | "currency" | "numberingSystem" | "timeZone" | "unit" +>enumerationKeys : readonly ["calendar", "collation", "currency", "numberingSystem", "timeZone", "unit"] + + var supported = Intl.supportedValuesOf(key); +>supported : string[] +>Intl.supportedValuesOf(key) : string[] +>Intl.supportedValuesOf : (key: Intl.EnumerationKeys) => string[] +>Intl : typeof Intl +>supportedValuesOf : (key: Intl.EnumerationKeys) => string[] +>key : "calendar" | "collation" | "currency" | "numberingSystem" | "timeZone" | "unit" +} + diff --git a/tests/cases/conformance/es2022/es2022IntlAPIs.ts b/tests/cases/conformance/es2022/es2022IntlAPIs.ts index f297e842b1a11..19d3160e71702 100644 --- a/tests/cases/conformance/es2022/es2022IntlAPIs.ts +++ b/tests/cases/conformance/es2022/es2022IntlAPIs.ts @@ -8,3 +8,8 @@ for (const zoneName of timezoneNames) { timeZoneName: zoneName, }); } + +const enumerationKeys = ['calendar', 'collation', 'currency', 'numberingSystem', 'timeZone', 'unit'] as const; +for (const key of enumerationKeys) { + var supported = Intl.supportedValuesOf(key); +} From 4857386c18f26174ff9de22f3b8b7f879c398bbb Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Wed, 12 Apr 2023 11:24:38 -0700 Subject: [PATCH 2/4] Address PR comments --- src/lib/es2022.intl.d.ts | 13 ---------- src/lib/esnext.intl.d.ts | 23 +++++++++++------ tests/baselines/reference/es2022IntlAPIs.js | 9 ------- .../reference/es2022IntlAPIs.symbols | 16 ------------ .../baselines/reference/es2022IntlAPIs.types | 24 ------------------ tests/baselines/reference/esNextIntlAPIs.js | 12 +++++++++ .../reference/esNextIntlAPIs.symbols | 17 +++++++++++++ .../baselines/reference/esNextIntlAPIs.types | 25 +++++++++++++++++++ .../conformance/es2022/es2022IntlAPIs.ts | 5 ---- .../conformance/esnext/esNextIntlAPIs.ts | 5 ++++ 10 files changed, 75 insertions(+), 74 deletions(-) create mode 100644 tests/baselines/reference/esNextIntlAPIs.js create mode 100644 tests/baselines/reference/esNextIntlAPIs.symbols create mode 100644 tests/baselines/reference/esNextIntlAPIs.types create mode 100644 tests/cases/conformance/esnext/esNextIntlAPIs.ts diff --git a/src/lib/es2022.intl.d.ts b/src/lib/es2022.intl.d.ts index 656c6b2d1f031..0672ec4d2d4d4 100644 --- a/src/lib/es2022.intl.d.ts +++ b/src/lib/es2022.intl.d.ts @@ -88,17 +88,4 @@ declare namespace Intl { */ supportedLocalesOf(locales: BCP47LanguageTag | BCP47LanguageTag[], options?: Pick): BCP47LanguageTag[]; }; - - type EnumerationKeys = "calendar" | "collation" | "currency" | "numberingSystem" | "timeZone" | "unit"; - - /** - * Returns a list of the supported collation, calendar, currency, numbering system, timezones, and units by the implementation. - * - * @param key A string indicating the category of values to return. - * - * @returns {string[]} A list of the supported values. - * - * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/supportedValuesOf) - */ - function supportedValuesOf(key: EnumerationKeys): string[]; } diff --git a/src/lib/esnext.intl.d.ts b/src/lib/esnext.intl.d.ts index 3c5a0bd4df9a3..0789dfe5143e4 100644 --- a/src/lib/esnext.intl.d.ts +++ b/src/lib/esnext.intl.d.ts @@ -1,10 +1,19 @@ declare namespace Intl { - interface NumberRangeFormatPart extends NumberFormatPart { - source: "startRange" | "endRange" | "shared" - } + interface NumberRangeFormatPart extends NumberFormatPart { + source: "startRange" | "endRange" | "shared" + } - interface NumberFormat { - formatRange(start: number | bigint, end: number | bigint): string; - formatRangeToParts(start: number | bigint, end: number | bigint): NumberRangeFormatPart[]; - } + interface NumberFormat { + formatRange(start: number | bigint, end: number | bigint): string; + formatRangeToParts(start: number | bigint, end: number | bigint): NumberRangeFormatPart[]; + } + + /** + * Returns a sorted array of the supported collation, calendar, currency, numbering system, timezones, and units by the implementation. + * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/supportedValuesOf) + * + * @param key A string indicating the category of values to return. + * @returns A sorted array of the supported values. + */ + function supportedValuesOf(key: "calendar" | "collation" | "currency" | "numberingSystem" | "timeZone" | "unit"): string[]; } diff --git a/tests/baselines/reference/es2022IntlAPIs.js b/tests/baselines/reference/es2022IntlAPIs.js index 32901521ed89b..8611c0bf51524 100644 --- a/tests/baselines/reference/es2022IntlAPIs.js +++ b/tests/baselines/reference/es2022IntlAPIs.js @@ -7,11 +7,6 @@ for (const zoneName of timezoneNames) { timeZoneName: zoneName, }); } - -const enumerationKeys = ['calendar', 'collation', 'currency', 'numberingSystem', 'timeZone', 'unit'] as const; -for (const key of enumerationKeys) { - var supported = Intl.supportedValuesOf(key); -} //// [es2022IntlAPIs.js] @@ -23,7 +18,3 @@ for (const zoneName of timezoneNames) { timeZoneName: zoneName, }); } -const enumerationKeys = ['calendar', 'collation', 'currency', 'numberingSystem', 'timeZone', 'unit']; -for (const key of enumerationKeys) { - var supported = Intl.supportedValuesOf(key); -} diff --git a/tests/baselines/reference/es2022IntlAPIs.symbols b/tests/baselines/reference/es2022IntlAPIs.symbols index 33bec6369ec64..60942707e9883 100644 --- a/tests/baselines/reference/es2022IntlAPIs.symbols +++ b/tests/baselines/reference/es2022IntlAPIs.symbols @@ -24,19 +24,3 @@ for (const zoneName of timezoneNames) { }); } -const enumerationKeys = ['calendar', 'collation', 'currency', 'numberingSystem', 'timeZone', 'unit'] as const; ->enumerationKeys : Symbol(enumerationKeys, Decl(es2022IntlAPIs.ts, 9, 5)) ->const : Symbol(const) - -for (const key of enumerationKeys) { ->key : Symbol(key, Decl(es2022IntlAPIs.ts, 10, 10)) ->enumerationKeys : Symbol(enumerationKeys, Decl(es2022IntlAPIs.ts, 9, 5)) - - var supported = Intl.supportedValuesOf(key); ->supported : Symbol(supported, Decl(es2022IntlAPIs.ts, 11, 5)) ->Intl.supportedValuesOf : Symbol(Intl.supportedValuesOf, Decl(lib.es2022.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.es2019.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --) ... and 3 more) ->supportedValuesOf : Symbol(Intl.supportedValuesOf, Decl(lib.es2022.intl.d.ts, --, --)) ->key : Symbol(key, Decl(es2022IntlAPIs.ts, 10, 10)) -} - diff --git a/tests/baselines/reference/es2022IntlAPIs.types b/tests/baselines/reference/es2022IntlAPIs.types index 7a3af046f3e8e..d6a0ac5049eec 100644 --- a/tests/baselines/reference/es2022IntlAPIs.types +++ b/tests/baselines/reference/es2022IntlAPIs.types @@ -35,27 +35,3 @@ for (const zoneName of timezoneNames) { }); } -const enumerationKeys = ['calendar', 'collation', 'currency', 'numberingSystem', 'timeZone', 'unit'] as const; ->enumerationKeys : readonly ["calendar", "collation", "currency", "numberingSystem", "timeZone", "unit"] ->['calendar', 'collation', 'currency', 'numberingSystem', 'timeZone', 'unit'] as const : readonly ["calendar", "collation", "currency", "numberingSystem", "timeZone", "unit"] ->['calendar', 'collation', 'currency', 'numberingSystem', 'timeZone', 'unit'] : readonly ["calendar", "collation", "currency", "numberingSystem", "timeZone", "unit"] ->'calendar' : "calendar" ->'collation' : "collation" ->'currency' : "currency" ->'numberingSystem' : "numberingSystem" ->'timeZone' : "timeZone" ->'unit' : "unit" - -for (const key of enumerationKeys) { ->key : "calendar" | "collation" | "currency" | "numberingSystem" | "timeZone" | "unit" ->enumerationKeys : readonly ["calendar", "collation", "currency", "numberingSystem", "timeZone", "unit"] - - var supported = Intl.supportedValuesOf(key); ->supported : string[] ->Intl.supportedValuesOf(key) : string[] ->Intl.supportedValuesOf : (key: Intl.EnumerationKeys) => string[] ->Intl : typeof Intl ->supportedValuesOf : (key: Intl.EnumerationKeys) => string[] ->key : "calendar" | "collation" | "currency" | "numberingSystem" | "timeZone" | "unit" -} - diff --git a/tests/baselines/reference/esNextIntlAPIs.js b/tests/baselines/reference/esNextIntlAPIs.js new file mode 100644 index 0000000000000..b282bcdbca396 --- /dev/null +++ b/tests/baselines/reference/esNextIntlAPIs.js @@ -0,0 +1,12 @@ +//// [esNextIntlAPIs.ts] +const enumerationKeys = ['calendar', 'collation', 'currency', 'numberingSystem', 'timeZone', 'unit'] as const; +for (const key of enumerationKeys) { + var supported = Intl.supportedValuesOf(key); +} + + +//// [esNextIntlAPIs.js] +const enumerationKeys = ['calendar', 'collation', 'currency', 'numberingSystem', 'timeZone', 'unit']; +for (const key of enumerationKeys) { + var supported = Intl.supportedValuesOf(key); +} diff --git a/tests/baselines/reference/esNextIntlAPIs.symbols b/tests/baselines/reference/esNextIntlAPIs.symbols new file mode 100644 index 0000000000000..49e564c3e65ce --- /dev/null +++ b/tests/baselines/reference/esNextIntlAPIs.symbols @@ -0,0 +1,17 @@ +=== tests/cases/conformance/esnext/esNextIntlAPIs.ts === +const enumerationKeys = ['calendar', 'collation', 'currency', 'numberingSystem', 'timeZone', 'unit'] as const; +>enumerationKeys : Symbol(enumerationKeys, Decl(esNextIntlAPIs.ts, 0, 5)) +>const : Symbol(const) + +for (const key of enumerationKeys) { +>key : Symbol(key, Decl(esNextIntlAPIs.ts, 1, 10)) +>enumerationKeys : Symbol(enumerationKeys, Decl(esNextIntlAPIs.ts, 0, 5)) + + var supported = Intl.supportedValuesOf(key); +>supported : Symbol(supported, Decl(esNextIntlAPIs.ts, 2, 5)) +>Intl.supportedValuesOf : Symbol(Intl.supportedValuesOf, 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.es2019.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --) ... and 4 more) +>supportedValuesOf : Symbol(Intl.supportedValuesOf, Decl(lib.esnext.intl.d.ts, --, --)) +>key : Symbol(key, Decl(esNextIntlAPIs.ts, 1, 10)) +} + diff --git a/tests/baselines/reference/esNextIntlAPIs.types b/tests/baselines/reference/esNextIntlAPIs.types new file mode 100644 index 0000000000000..67ea325ad9452 --- /dev/null +++ b/tests/baselines/reference/esNextIntlAPIs.types @@ -0,0 +1,25 @@ +=== tests/cases/conformance/esnext/esNextIntlAPIs.ts === +const enumerationKeys = ['calendar', 'collation', 'currency', 'numberingSystem', 'timeZone', 'unit'] as const; +>enumerationKeys : readonly ["calendar", "collation", "currency", "numberingSystem", "timeZone", "unit"] +>['calendar', 'collation', 'currency', 'numberingSystem', 'timeZone', 'unit'] as const : readonly ["calendar", "collation", "currency", "numberingSystem", "timeZone", "unit"] +>['calendar', 'collation', 'currency', 'numberingSystem', 'timeZone', 'unit'] : readonly ["calendar", "collation", "currency", "numberingSystem", "timeZone", "unit"] +>'calendar' : "calendar" +>'collation' : "collation" +>'currency' : "currency" +>'numberingSystem' : "numberingSystem" +>'timeZone' : "timeZone" +>'unit' : "unit" + +for (const key of enumerationKeys) { +>key : "calendar" | "collation" | "currency" | "numberingSystem" | "timeZone" | "unit" +>enumerationKeys : readonly ["calendar", "collation", "currency", "numberingSystem", "timeZone", "unit"] + + var supported = Intl.supportedValuesOf(key); +>supported : string[] +>Intl.supportedValuesOf(key) : string[] +>Intl.supportedValuesOf : (key: "calendar" | "collation" | "currency" | "numberingSystem" | "timeZone" | "unit") => string[] +>Intl : typeof Intl +>supportedValuesOf : (key: "calendar" | "collation" | "currency" | "numberingSystem" | "timeZone" | "unit") => string[] +>key : "calendar" | "collation" | "currency" | "numberingSystem" | "timeZone" | "unit" +} + diff --git a/tests/cases/conformance/es2022/es2022IntlAPIs.ts b/tests/cases/conformance/es2022/es2022IntlAPIs.ts index 19d3160e71702..f297e842b1a11 100644 --- a/tests/cases/conformance/es2022/es2022IntlAPIs.ts +++ b/tests/cases/conformance/es2022/es2022IntlAPIs.ts @@ -8,8 +8,3 @@ for (const zoneName of timezoneNames) { timeZoneName: zoneName, }); } - -const enumerationKeys = ['calendar', 'collation', 'currency', 'numberingSystem', 'timeZone', 'unit'] as const; -for (const key of enumerationKeys) { - var supported = Intl.supportedValuesOf(key); -} diff --git a/tests/cases/conformance/esnext/esNextIntlAPIs.ts b/tests/cases/conformance/esnext/esNextIntlAPIs.ts new file mode 100644 index 0000000000000..3295691a34036 --- /dev/null +++ b/tests/cases/conformance/esnext/esNextIntlAPIs.ts @@ -0,0 +1,5 @@ +// @target: esnext +const enumerationKeys = ['calendar', 'collation', 'currency', 'numberingSystem', 'timeZone', 'unit'] as const; +for (const key of enumerationKeys) { + var supported = Intl.supportedValuesOf(key); +} From 99013d34213ce22ce5b5a34e15cd2e71d0f4dbd3 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Wed, 12 Apr 2023 11:32:10 -0700 Subject: [PATCH 3/4] Revert "Address PR comments" This reverts commit 4857386c18f26174ff9de22f3b8b7f879c398bbb. --- src/lib/es2022.intl.d.ts | 13 ++++++++++ src/lib/esnext.intl.d.ts | 23 ++++++----------- tests/baselines/reference/es2022IntlAPIs.js | 9 +++++++ .../reference/es2022IntlAPIs.symbols | 16 ++++++++++++ .../baselines/reference/es2022IntlAPIs.types | 24 ++++++++++++++++++ tests/baselines/reference/esNextIntlAPIs.js | 12 --------- .../reference/esNextIntlAPIs.symbols | 17 ------------- .../baselines/reference/esNextIntlAPIs.types | 25 ------------------- .../conformance/es2022/es2022IntlAPIs.ts | 5 ++++ .../conformance/esnext/esNextIntlAPIs.ts | 5 ---- 10 files changed, 74 insertions(+), 75 deletions(-) delete mode 100644 tests/baselines/reference/esNextIntlAPIs.js delete mode 100644 tests/baselines/reference/esNextIntlAPIs.symbols delete mode 100644 tests/baselines/reference/esNextIntlAPIs.types delete mode 100644 tests/cases/conformance/esnext/esNextIntlAPIs.ts diff --git a/src/lib/es2022.intl.d.ts b/src/lib/es2022.intl.d.ts index 0672ec4d2d4d4..656c6b2d1f031 100644 --- a/src/lib/es2022.intl.d.ts +++ b/src/lib/es2022.intl.d.ts @@ -88,4 +88,17 @@ declare namespace Intl { */ supportedLocalesOf(locales: BCP47LanguageTag | BCP47LanguageTag[], options?: Pick): BCP47LanguageTag[]; }; + + type EnumerationKeys = "calendar" | "collation" | "currency" | "numberingSystem" | "timeZone" | "unit"; + + /** + * Returns a list of the supported collation, calendar, currency, numbering system, timezones, and units by the implementation. + * + * @param key A string indicating the category of values to return. + * + * @returns {string[]} A list of the supported values. + * + * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/supportedValuesOf) + */ + function supportedValuesOf(key: EnumerationKeys): string[]; } diff --git a/src/lib/esnext.intl.d.ts b/src/lib/esnext.intl.d.ts index 0789dfe5143e4..3c5a0bd4df9a3 100644 --- a/src/lib/esnext.intl.d.ts +++ b/src/lib/esnext.intl.d.ts @@ -1,19 +1,10 @@ declare namespace Intl { - interface NumberRangeFormatPart extends NumberFormatPart { - source: "startRange" | "endRange" | "shared" - } + interface NumberRangeFormatPart extends NumberFormatPart { + source: "startRange" | "endRange" | "shared" + } - interface NumberFormat { - formatRange(start: number | bigint, end: number | bigint): string; - formatRangeToParts(start: number | bigint, end: number | bigint): NumberRangeFormatPart[]; - } - - /** - * Returns a sorted array of the supported collation, calendar, currency, numbering system, timezones, and units by the implementation. - * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/supportedValuesOf) - * - * @param key A string indicating the category of values to return. - * @returns A sorted array of the supported values. - */ - function supportedValuesOf(key: "calendar" | "collation" | "currency" | "numberingSystem" | "timeZone" | "unit"): string[]; + interface NumberFormat { + formatRange(start: number | bigint, end: number | bigint): string; + formatRangeToParts(start: number | bigint, end: number | bigint): NumberRangeFormatPart[]; + } } diff --git a/tests/baselines/reference/es2022IntlAPIs.js b/tests/baselines/reference/es2022IntlAPIs.js index 8611c0bf51524..32901521ed89b 100644 --- a/tests/baselines/reference/es2022IntlAPIs.js +++ b/tests/baselines/reference/es2022IntlAPIs.js @@ -7,6 +7,11 @@ for (const zoneName of timezoneNames) { timeZoneName: zoneName, }); } + +const enumerationKeys = ['calendar', 'collation', 'currency', 'numberingSystem', 'timeZone', 'unit'] as const; +for (const key of enumerationKeys) { + var supported = Intl.supportedValuesOf(key); +} //// [es2022IntlAPIs.js] @@ -18,3 +23,7 @@ for (const zoneName of timezoneNames) { timeZoneName: zoneName, }); } +const enumerationKeys = ['calendar', 'collation', 'currency', 'numberingSystem', 'timeZone', 'unit']; +for (const key of enumerationKeys) { + var supported = Intl.supportedValuesOf(key); +} diff --git a/tests/baselines/reference/es2022IntlAPIs.symbols b/tests/baselines/reference/es2022IntlAPIs.symbols index 60942707e9883..33bec6369ec64 100644 --- a/tests/baselines/reference/es2022IntlAPIs.symbols +++ b/tests/baselines/reference/es2022IntlAPIs.symbols @@ -24,3 +24,19 @@ for (const zoneName of timezoneNames) { }); } +const enumerationKeys = ['calendar', 'collation', 'currency', 'numberingSystem', 'timeZone', 'unit'] as const; +>enumerationKeys : Symbol(enumerationKeys, Decl(es2022IntlAPIs.ts, 9, 5)) +>const : Symbol(const) + +for (const key of enumerationKeys) { +>key : Symbol(key, Decl(es2022IntlAPIs.ts, 10, 10)) +>enumerationKeys : Symbol(enumerationKeys, Decl(es2022IntlAPIs.ts, 9, 5)) + + var supported = Intl.supportedValuesOf(key); +>supported : Symbol(supported, Decl(es2022IntlAPIs.ts, 11, 5)) +>Intl.supportedValuesOf : Symbol(Intl.supportedValuesOf, Decl(lib.es2022.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.es2019.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --) ... and 3 more) +>supportedValuesOf : Symbol(Intl.supportedValuesOf, Decl(lib.es2022.intl.d.ts, --, --)) +>key : Symbol(key, Decl(es2022IntlAPIs.ts, 10, 10)) +} + diff --git a/tests/baselines/reference/es2022IntlAPIs.types b/tests/baselines/reference/es2022IntlAPIs.types index d6a0ac5049eec..7a3af046f3e8e 100644 --- a/tests/baselines/reference/es2022IntlAPIs.types +++ b/tests/baselines/reference/es2022IntlAPIs.types @@ -35,3 +35,27 @@ for (const zoneName of timezoneNames) { }); } +const enumerationKeys = ['calendar', 'collation', 'currency', 'numberingSystem', 'timeZone', 'unit'] as const; +>enumerationKeys : readonly ["calendar", "collation", "currency", "numberingSystem", "timeZone", "unit"] +>['calendar', 'collation', 'currency', 'numberingSystem', 'timeZone', 'unit'] as const : readonly ["calendar", "collation", "currency", "numberingSystem", "timeZone", "unit"] +>['calendar', 'collation', 'currency', 'numberingSystem', 'timeZone', 'unit'] : readonly ["calendar", "collation", "currency", "numberingSystem", "timeZone", "unit"] +>'calendar' : "calendar" +>'collation' : "collation" +>'currency' : "currency" +>'numberingSystem' : "numberingSystem" +>'timeZone' : "timeZone" +>'unit' : "unit" + +for (const key of enumerationKeys) { +>key : "calendar" | "collation" | "currency" | "numberingSystem" | "timeZone" | "unit" +>enumerationKeys : readonly ["calendar", "collation", "currency", "numberingSystem", "timeZone", "unit"] + + var supported = Intl.supportedValuesOf(key); +>supported : string[] +>Intl.supportedValuesOf(key) : string[] +>Intl.supportedValuesOf : (key: Intl.EnumerationKeys) => string[] +>Intl : typeof Intl +>supportedValuesOf : (key: Intl.EnumerationKeys) => string[] +>key : "calendar" | "collation" | "currency" | "numberingSystem" | "timeZone" | "unit" +} + diff --git a/tests/baselines/reference/esNextIntlAPIs.js b/tests/baselines/reference/esNextIntlAPIs.js deleted file mode 100644 index b282bcdbca396..0000000000000 --- a/tests/baselines/reference/esNextIntlAPIs.js +++ /dev/null @@ -1,12 +0,0 @@ -//// [esNextIntlAPIs.ts] -const enumerationKeys = ['calendar', 'collation', 'currency', 'numberingSystem', 'timeZone', 'unit'] as const; -for (const key of enumerationKeys) { - var supported = Intl.supportedValuesOf(key); -} - - -//// [esNextIntlAPIs.js] -const enumerationKeys = ['calendar', 'collation', 'currency', 'numberingSystem', 'timeZone', 'unit']; -for (const key of enumerationKeys) { - var supported = Intl.supportedValuesOf(key); -} diff --git a/tests/baselines/reference/esNextIntlAPIs.symbols b/tests/baselines/reference/esNextIntlAPIs.symbols deleted file mode 100644 index 49e564c3e65ce..0000000000000 --- a/tests/baselines/reference/esNextIntlAPIs.symbols +++ /dev/null @@ -1,17 +0,0 @@ -=== tests/cases/conformance/esnext/esNextIntlAPIs.ts === -const enumerationKeys = ['calendar', 'collation', 'currency', 'numberingSystem', 'timeZone', 'unit'] as const; ->enumerationKeys : Symbol(enumerationKeys, Decl(esNextIntlAPIs.ts, 0, 5)) ->const : Symbol(const) - -for (const key of enumerationKeys) { ->key : Symbol(key, Decl(esNextIntlAPIs.ts, 1, 10)) ->enumerationKeys : Symbol(enumerationKeys, Decl(esNextIntlAPIs.ts, 0, 5)) - - var supported = Intl.supportedValuesOf(key); ->supported : Symbol(supported, Decl(esNextIntlAPIs.ts, 2, 5)) ->Intl.supportedValuesOf : Symbol(Intl.supportedValuesOf, 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.es2019.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --) ... and 4 more) ->supportedValuesOf : Symbol(Intl.supportedValuesOf, Decl(lib.esnext.intl.d.ts, --, --)) ->key : Symbol(key, Decl(esNextIntlAPIs.ts, 1, 10)) -} - diff --git a/tests/baselines/reference/esNextIntlAPIs.types b/tests/baselines/reference/esNextIntlAPIs.types deleted file mode 100644 index 67ea325ad9452..0000000000000 --- a/tests/baselines/reference/esNextIntlAPIs.types +++ /dev/null @@ -1,25 +0,0 @@ -=== tests/cases/conformance/esnext/esNextIntlAPIs.ts === -const enumerationKeys = ['calendar', 'collation', 'currency', 'numberingSystem', 'timeZone', 'unit'] as const; ->enumerationKeys : readonly ["calendar", "collation", "currency", "numberingSystem", "timeZone", "unit"] ->['calendar', 'collation', 'currency', 'numberingSystem', 'timeZone', 'unit'] as const : readonly ["calendar", "collation", "currency", "numberingSystem", "timeZone", "unit"] ->['calendar', 'collation', 'currency', 'numberingSystem', 'timeZone', 'unit'] : readonly ["calendar", "collation", "currency", "numberingSystem", "timeZone", "unit"] ->'calendar' : "calendar" ->'collation' : "collation" ->'currency' : "currency" ->'numberingSystem' : "numberingSystem" ->'timeZone' : "timeZone" ->'unit' : "unit" - -for (const key of enumerationKeys) { ->key : "calendar" | "collation" | "currency" | "numberingSystem" | "timeZone" | "unit" ->enumerationKeys : readonly ["calendar", "collation", "currency", "numberingSystem", "timeZone", "unit"] - - var supported = Intl.supportedValuesOf(key); ->supported : string[] ->Intl.supportedValuesOf(key) : string[] ->Intl.supportedValuesOf : (key: "calendar" | "collation" | "currency" | "numberingSystem" | "timeZone" | "unit") => string[] ->Intl : typeof Intl ->supportedValuesOf : (key: "calendar" | "collation" | "currency" | "numberingSystem" | "timeZone" | "unit") => string[] ->key : "calendar" | "collation" | "currency" | "numberingSystem" | "timeZone" | "unit" -} - diff --git a/tests/cases/conformance/es2022/es2022IntlAPIs.ts b/tests/cases/conformance/es2022/es2022IntlAPIs.ts index f297e842b1a11..19d3160e71702 100644 --- a/tests/cases/conformance/es2022/es2022IntlAPIs.ts +++ b/tests/cases/conformance/es2022/es2022IntlAPIs.ts @@ -8,3 +8,8 @@ for (const zoneName of timezoneNames) { timeZoneName: zoneName, }); } + +const enumerationKeys = ['calendar', 'collation', 'currency', 'numberingSystem', 'timeZone', 'unit'] as const; +for (const key of enumerationKeys) { + var supported = Intl.supportedValuesOf(key); +} diff --git a/tests/cases/conformance/esnext/esNextIntlAPIs.ts b/tests/cases/conformance/esnext/esNextIntlAPIs.ts deleted file mode 100644 index 3295691a34036..0000000000000 --- a/tests/cases/conformance/esnext/esNextIntlAPIs.ts +++ /dev/null @@ -1,5 +0,0 @@ -// @target: esnext -const enumerationKeys = ['calendar', 'collation', 'currency', 'numberingSystem', 'timeZone', 'unit'] as const; -for (const key of enumerationKeys) { - var supported = Intl.supportedValuesOf(key); -} From f0168688595852fa5118e324cd80af888e0e544b Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Wed, 12 Apr 2023 11:37:06 -0700 Subject: [PATCH 4/4] Better address PR comments --- src/lib/es2022.intl.d.ts | 12 ++++-------- tests/baselines/reference/es2022IntlAPIs.types | 4 ++-- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/lib/es2022.intl.d.ts b/src/lib/es2022.intl.d.ts index 656c6b2d1f031..987b621559777 100644 --- a/src/lib/es2022.intl.d.ts +++ b/src/lib/es2022.intl.d.ts @@ -89,16 +89,12 @@ declare namespace Intl { supportedLocalesOf(locales: BCP47LanguageTag | BCP47LanguageTag[], options?: Pick): BCP47LanguageTag[]; }; - type EnumerationKeys = "calendar" | "collation" | "currency" | "numberingSystem" | "timeZone" | "unit"; - /** - * Returns a list of the supported collation, calendar, currency, numbering system, timezones, and units by the implementation. + * Returns a sorted array of the supported collation, calendar, currency, numbering system, timezones, and units by the implementation. + * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/supportedValuesOf) * * @param key A string indicating the category of values to return. - * - * @returns {string[]} A list of the supported values. - * - * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/supportedValuesOf) + * @returns A sorted array of the supported values. */ - function supportedValuesOf(key: EnumerationKeys): string[]; + function supportedValuesOf(key: "calendar" | "collation" | "currency" | "numberingSystem" | "timeZone" | "unit"): string[]; } diff --git a/tests/baselines/reference/es2022IntlAPIs.types b/tests/baselines/reference/es2022IntlAPIs.types index 7a3af046f3e8e..1915c84bd628d 100644 --- a/tests/baselines/reference/es2022IntlAPIs.types +++ b/tests/baselines/reference/es2022IntlAPIs.types @@ -53,9 +53,9 @@ for (const key of enumerationKeys) { var supported = Intl.supportedValuesOf(key); >supported : string[] >Intl.supportedValuesOf(key) : string[] ->Intl.supportedValuesOf : (key: Intl.EnumerationKeys) => string[] +>Intl.supportedValuesOf : (key: "calendar" | "collation" | "currency" | "numberingSystem" | "timeZone" | "unit") => string[] >Intl : typeof Intl ->supportedValuesOf : (key: Intl.EnumerationKeys) => string[] +>supportedValuesOf : (key: "calendar" | "collation" | "currency" | "numberingSystem" | "timeZone" | "unit") => string[] >key : "calendar" | "collation" | "currency" | "numberingSystem" | "timeZone" | "unit" }