mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 08:11:30 -06:00
add Intl.supportedValuesOf (#53511)
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
This commit is contained in:
parent
a26175bffb
commit
fd6f61ea6b
9
src/lib/es2022.intl.d.ts
vendored
9
src/lib/es2022.intl.d.ts
vendored
@ -88,4 +88,13 @@ declare namespace Intl {
|
||||
*/
|
||||
supportedLocalesOf(locales: BCP47LanguageTag | BCP47LanguageTag[], options?: Pick<SegmenterOptions, "localeMatcher">): BCP47LanguageTag[];
|
||||
};
|
||||
|
||||
/**
|
||||
* 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[];
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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))
|
||||
}
|
||||
|
||||
|
||||
@ -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: "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"
|
||||
}
|
||||
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user