Skip to content

Commit

Permalink
Address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sandersn committed Apr 12, 2023
1 parent e0e1bde commit 4857386
Show file tree
Hide file tree
Showing 10 changed files with 75 additions and 74 deletions.
13 changes: 0 additions & 13 deletions src/lib/es2022.intl.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,4 @@ declare namespace Intl {
*/
supportedLocalesOf(locales: BCP47LanguageTag | BCP47LanguageTag[], options?: Pick<SegmenterOptions, "localeMatcher">): 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[];
}
23 changes: 16 additions & 7 deletions src/lib/esnext.intl.d.ts
Original file line number Diff line number Diff line change
@@ -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[];
}
9 changes: 0 additions & 9 deletions tests/baselines/reference/es2022IntlAPIs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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);
}
16 changes: 0 additions & 16 deletions tests/baselines/reference/es2022IntlAPIs.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}

24 changes: 0 additions & 24 deletions tests/baselines/reference/es2022IntlAPIs.types
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

12 changes: 12 additions & 0 deletions tests/baselines/reference/esNextIntlAPIs.js
Original file line number Diff line number Diff line change
@@ -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);
}
17 changes: 17 additions & 0 deletions tests/baselines/reference/esNextIntlAPIs.symbols
Original file line number Diff line number Diff line change
@@ -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))
}

25 changes: 25 additions & 0 deletions tests/baselines/reference/esNextIntlAPIs.types
Original file line number Diff line number Diff line change
@@ -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"
}

5 changes: 0 additions & 5 deletions tests/cases/conformance/es2022/es2022IntlAPIs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
5 changes: 5 additions & 0 deletions tests/cases/conformance/esnext/esNextIntlAPIs.ts
Original file line number Diff line number Diff line change
@@ -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);
}

0 comments on commit 4857386

Please sign in to comment.