summaryrefslogtreecommitdiff
path: root/cli/dts/lib.es2020.intl.d.ts
diff options
context:
space:
mode:
Diffstat (limited to 'cli/dts/lib.es2020.intl.d.ts')
-rw-r--r--cli/dts/lib.es2020.intl.d.ts287
1 files changed, 173 insertions, 114 deletions
diff --git a/cli/dts/lib.es2020.intl.d.ts b/cli/dts/lib.es2020.intl.d.ts
index 2470d08b6..47fe33ffd 100644
--- a/cli/dts/lib.es2020.intl.d.ts
+++ b/cli/dts/lib.es2020.intl.d.ts
@@ -24,7 +24,6 @@ declare namespace Intl {
* [Unicode BCP 47 Locale Identifiers](https://unicode.org/reports/tr35/#Unicode_Language_and_Locale_Identifiers) definition.
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument).
- *
*/
type UnicodeBCP47LocaleIdentifier = string;
@@ -32,26 +31,29 @@ declare namespace Intl {
* Unit to use in the relative time internationalized message.
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/format#Parameters).
- *
- * [Specification](https://tc39.es/ecma402/#sec-singularrelativetimeunit).
*/
type RelativeTimeFormatUnit =
- | "year" | "years"
- | "quarter" | "quarters"
- | "month" | "months"
- | "week" | "weeks"
- | "day" | "days"
- | "hour" | "hours"
- | "minute" | "minutes"
- | "second" | "seconds"
- ;
+ | "year"
+ | "years"
+ | "quarter"
+ | "quarters"
+ | "month"
+ | "months"
+ | "week"
+ | "weeks"
+ | "day"
+ | "days"
+ | "hour"
+ | "hours"
+ | "minute"
+ | "minutes"
+ | "second"
+ | "seconds";
/**
* The locale matching algorithm to use.
*
* [MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_negotiation).
- *
- * [Specification](https://tc39.es/ecma402/#sec-InitializeRelativeTimeFormat).
*/
type RelativeTimeFormatLocaleMatcher = "lookup" | "best fit";
@@ -59,8 +61,6 @@ declare namespace Intl {
* The format of output message.
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat#Parameters).
- *
- * [Specification](https://tc39.es/ecma402/#sec-InitializeRelativeTimeFormat).
*/
type RelativeTimeFormatNumeric = "always" | "auto";
@@ -68,33 +68,37 @@ declare namespace Intl {
* The length of the internationalized message.
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat#Parameters).
- *
- * [Specification](https://tc39.es/ecma402/#sec-InitializeRelativeTimeFormat).
*/
type RelativeTimeFormatStyle = "long" | "short" | "narrow";
/**
+ * [BCP 47 language tag](http://tools.ietf.org/html/rfc5646) definition.
+ *
+ * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument).
+ */
+ type BCP47LanguageTag = string;
+
+ /**
* An object with some or all of properties of `options` parameter
* of `Intl.RelativeTimeFormat` constructor.
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat#Parameters).
- *
- * [Specification](https://tc39.es/ecma402/#sec-InitializeRelativeTimeFormat).
*/
interface RelativeTimeFormatOptions {
+ /** The locale matching algorithm to use. For information about this option, see [Intl page](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_negotiation). */
localeMatcher?: RelativeTimeFormatLocaleMatcher;
+ /** The format of output message. */
numeric?: RelativeTimeFormatNumeric;
+ /** The length of the internationalized message. */
style?: RelativeTimeFormatStyle;
}
/**
* An object with properties reflecting the locale
* and formatting options computed during initialization
- * of the `Intel.RelativeTimeFormat` object
+ * of the `Intl.RelativeTimeFormat` object
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/resolvedOptions#Description).
- *
- * [Specification](https://tc39.es/ecma402/#table-relativetimeformat-resolvedoptions-properties)
*/
interface ResolvedRelativeTimeFormatOptions {
locale: UnicodeBCP47LocaleIdentifier;
@@ -108,8 +112,6 @@ declare namespace Intl {
* that can be used for custom locale-aware formatting.
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/formatToParts#Using_formatToParts).
- *
- * [Specification](https://tc39.es/ecma402/#sec-FormatRelativeTimeToParts).
*/
interface RelativeTimeFormatPart {
type: string;
@@ -126,6 +128,7 @@ declare namespace Intl {
*
* While this method automatically provides the correct plural forms,
* the grammatical form is otherwise as neutral as possible.
+ *
* It is the caller's responsibility to handle cut-off logic
* such as deciding between displaying "in 7 days" or "in 1 week".
* This API does not support relative dates involving compound units.
@@ -133,68 +136,33 @@ declare namespace Intl {
*
* @param value - Numeric value to use in the internationalized relative time message
*
- * @param unit - [Unit](https://tc39.es/ecma402/#sec-singularrelativetimeunit)
- * to use in the relative time internationalized message.
- * Possible values are: `"year"`, `"quarter"`, `"month"`, `"week"`,
- * `"day"`, `"hour"`, `"minute"`, `"second"`.
- * Plural forms are also permitted.
+ * @param unit - [Unit](https://tc39.es/ecma402/#sec-singularrelativetimeunit) to use in the relative time internationalized message.
*
* @throws `RangeError` if `unit` was given something other than `unit` possible values
*
- * @returns Internationalized relative time message as string
+ * @returns {string} Internationalized relative time message as string
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/format).
- *
- * [Specification](https://tc39.es/ecma402/#sec-Intl.RelativeTimeFormat.prototype.format).
*/
- format(
- value: number,
- unit: RelativeTimeFormatUnit,
- ): string;
+ format(value: number, unit: RelativeTimeFormatUnit): string;
/**
- * A version of the format method which it returns an array of objects
- * which represent "parts" of the object,
- * separating the formatted number into its constituent parts
- * and separating it from other surrounding text.
- * These objects have two properties:
- * `type` a NumberFormat formatToParts type, and `value`,
- * which is the String which is the component of the output.
- * If a "part" came from NumberFormat,
- * it will have a unit property which indicates the `unit` being formatted;
- * literals which are part of the larger frame will not have this property.
+ * Returns an array of objects representing the relative time format in parts that can be used for custom locale-aware formatting.
*
* @param value - Numeric value to use in the internationalized relative time message
*
- * @param unit - [Unit](https://tc39.es/ecma402/#sec-singularrelativetimeunit)
- * to use in the relative time internationalized message.
- * Possible values are: `"year"`, `"quarter"`, `"month"`, `"week"`,
- * `"day"`, `"hour"`, `"minute"`, `"second"`.
- * Plural forms are also permitted.
+ * @param unit - [Unit](https://tc39.es/ecma402/#sec-singularrelativetimeunit) to use in the relative time internationalized message.
*
* @throws `RangeError` if `unit` was given something other than `unit` possible values
*
- * @returns Array of [FormatRelativeTimeToParts](https://tc39.es/ecma402/#sec-FormatRelativeTimeToParts)
- *
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/formatToParts).
- *
- * [Specification](https://tc39.es/ecma402/#sec-Intl.RelativeTimeFormat.prototype.formatToParts).
*/
- formatToParts(
- value: number,
- unit: RelativeTimeFormatUnit,
- ): RelativeTimeFormatPart[];
+ formatToParts(value: number, unit: RelativeTimeFormatUnit): RelativeTimeFormatPart[];
/**
* Provides access to the locale and options computed during initialization of this `Intl.RelativeTimeFormat` object.
*
- * @returns A new object with properties reflecting the locale
- * and formatting options computed during initialization
- * of the `Intel.RelativeTimeFormat` object.
- *
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/resolvedOptions).
- *
- * [Specification](https://tc39.es/ecma402/#sec-intl.relativetimeformat.prototype.resolvedoptions)
*/
resolvedOptions(): ResolvedRelativeTimeFormatOptions;
}
@@ -203,41 +171,22 @@ declare namespace Intl {
* The [`Intl.RelativeTimeFormat`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RelativeTimeFormat)
* object is a constructor for objects that enable language-sensitive relative time formatting.
*
- * Part of [Intl object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl)
- * namespace and the [ECMAScript Internationalization API](https://www.ecma-international.org/publications/standards/Ecma-402.htm).
- *
* [Compatibility](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat#Browser_compatibility).
- *
- * [Polyfills](https://github.com/tc39/proposal-intl-relative-time#polyfills).
*/
const RelativeTimeFormat: {
/**
- * Constructor creates [Intl.RelativeTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RelativeTimeFormat)
- * objects
+ * Creates [Intl.RelativeTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RelativeTimeFormat) objects
*
* @param locales - A string with a [BCP 47 language tag](http://tools.ietf.org/html/rfc5646), or an array of such strings.
* For the general form and interpretation of the locales argument,
* see the [`Intl` page](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation).
*
* @param options - An [object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat#Parameters)
- * with some or all of options of the formatting.
- * An object with some or all of the following properties:
- * - `localeMatcher` - The locale matching algorithm to use.
- * Possible values are `"lookup"` and `"best fit"`; the default is `"best fit"`.
- * For information about this option, see [Intl page](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_negotiation).
- * - `numeric` - The format of output message.
- * Possible values are: `"always"` (default, e.g., `1 day ago`) or `"auto"` (e.g., `yesterday`).
- * The `"auto"` value allows to not always have to use numeric values in the output.
- * - `style` - The length of the internationalized message. Possible values are:
- * `"long"` (default, e.g., in 1 month),
- * `"short"` (e.g., in 1 mo.)
- * or `"narrow"` (e.g., in 1 mo.). The narrow style could be similar to the short style for some locales.
+ * with some or all of options of `RelativeTimeFormatOptions`.
*
* @returns [Intl.RelativeTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RelativeTimeFormat) object.
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat).
- *
- * [Specification](https://tc39.es/ecma402/#sec-intl-relativetimeformat-constructor).
*/
new(
locales?: UnicodeBCP47LocaleIdentifier | UnicodeBCP47LocaleIdentifier[],
@@ -255,25 +204,12 @@ declare namespace Intl {
*
* @param options - An [object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat#Parameters)
* with some or all of options of the formatting.
- * An object with some or all of the following properties:
- * - `localeMatcher` - The locale matching algorithm to use.
- * Possible values are `"lookup"` and `"best fit"`; the default is `"best fit"`.
- * For information about this option, see [Intl page](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_negotiation).
- * - `numeric` - The format of output message.
- * Possible values are: `"always"` (default, e.g., `1 day ago`) or `"auto"` (e.g., `yesterday`).
- * The `"auto"` value allows to not always have to use numeric values in the output.
- * - `style` - The length of the internationalized message. Possible values are:
- * `"long"` (default, e.g., in 1 month),
- * `"short"` (e.g., in 1 mo.)
- * or `"narrow"` (e.g., in 1 mo.). The narrow style could be similar to the short style for some locales.
*
* @returns An array containing those of the provided locales
* that are supported in date and time formatting
* without having to fall back to the runtime's default locale.
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/supportedLocalesOf).
- *
- * [Specification](https://tc39.es/ecma402/#sec-Intl.RelativeTimeFormat.supportedLocalesOf).
*/
supportedLocalesOf(
locales?: UnicodeBCP47LocaleIdentifier | UnicodeBCP47LocaleIdentifier[],
@@ -282,28 +218,151 @@ declare namespace Intl {
};
interface NumberFormatOptions {
- compactDisplay?: string;
- notation?: string;
- signDisplay?: string;
- unit?: string;
- unitDisplay?: string;
+ compactDisplay?: "short" | "long" | undefined;
+ notation?: "standard" | "scientific" | "engineering" | "compact" | undefined;
+ signDisplay?: "auto" | "never" | "always" | undefined;
+ unit?: string | undefined;
+ unitDisplay?: "short" | "long" | "narrow" | undefined;
}
interface ResolvedNumberFormatOptions {
- compactDisplay?: string;
- notation?: string;
- signDisplay?: string;
+ compactDisplay?: "short" | "long";
+ notation?: "standard" | "scientific" | "engineering" | "compact";
+ signDisplay?: "auto" | "never" | "always";
unit?: string;
- unitDisplay?: string;
+ unitDisplay?: "short" | "long" | "narrow";
}
interface DateTimeFormatOptions {
- dateStyle?: "full" | "long" | "medium" | "short";
- timeStyle?: "full" | "long" | "medium" | "short";
+ calendar?: string | undefined;
+ dayPeriod?: "narrow" | "short" | "long" | undefined;
+ numberingSystem?: string | undefined;
+
+ dateStyle?: "full" | "long" | "medium" | "short" | undefined;
+ timeStyle?: "full" | "long" | "medium" | "short" | undefined;
+ hourCycle?: "h11" | "h12" | "h23" | "h24" | undefined;
+ }
+
+ type LocaleHourCycleKey = "h12" | "h23" | "h11" | "h24";
+ type LocaleCollationCaseFirst = "upper" | "lower" | "false";
+
+ interface LocaleOptions {
+ /** A string containing the language, and the script and region if available. */
+ baseName?: string;
+ /** The part of the Locale that indicates the locale's calendar era. */
calendar?: string;
- dayPeriod?: "narrow" | "short" | "long";
+ /** Flag that defines whether case is taken into account for the locale's collation rules. */
+ caseFirst?: LocaleCollationCaseFirst;
+ /** The collation type used for sorting */
+ collation?: string;
+ /** The time keeping format convention used by the locale. */
+ hourCycle?: LocaleHourCycleKey;
+ /** The primary language subtag associated with the locale. */
+ language?: string;
+ /** The numeral system used by the locale. */
numberingSystem?: string;
- hourCycle?: "h11" | "h12" | "h23" | "h24";
- fractionalSecondDigits?: 0 | 1 | 2 | 3;
+ /** Flag that defines whether the locale has special collation handling for numeric characters. */
+ numeric?: boolean;
+ /** The region of the world (usually a country) associated with the locale. Possible values are region codes as defined by ISO 3166-1. */
+ region?: string;
+ /** The script used for writing the particular language used in the locale. Possible values are script codes as defined by ISO 15924. */
+ script?: string;
+ }
+
+ interface Locale extends LocaleOptions {
+ /** Gets the most likely values for the language, script, and region of the locale based on existing values. */
+ maximize(): Locale;
+ /** Attempts to remove information about the locale that would be added by calling `Locale.maximize()`. */
+ minimize(): Locale;
+ /** Returns the locale's full locale identifier string. */
+ toString(): BCP47LanguageTag;
}
+
+ /**
+ * Constructor creates [Intl.Locale](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale)
+ * objects
+ *
+ * @param tag - A string with a [BCP 47 language tag](http://tools.ietf.org/html/rfc5646).
+ * For the general form and interpretation of the locales argument,
+ * see the [`Intl` page](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation).
+ *
+ * @param options - An [object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/Locale#Parameters) with some or all of options of the locale.
+ *
+ * @returns [Intl.Locale](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale) object.
+ *
+ * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale).
+ */
+ const Locale: {
+ new (tag?: BCP47LanguageTag, options?: LocaleOptions): Locale;
+ };
+
+ interface DisplayNamesOptions {
+ localeMatcher: RelativeTimeFormatLocaleMatcher;
+ style: RelativeTimeFormatStyle;
+ type: "language" | "region" | "script" | "currency";
+ fallback: "code" | "none";
+ }
+
+ interface DisplayNames {
+ /**
+ * Receives a code and returns a string based on the locale and options provided when instantiating
+ * [`Intl.DisplayNames()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames)
+ *
+ * @param code The `code` to provide depends on the `type` passed to display name during creation:
+ * - If the type is `"region"`, code should be either an [ISO-3166 two letters region code](https://www.iso.org/iso-3166-country-codes.html),
+ * or a [three digits UN M49 Geographic Regions](https://unstats.un.org/unsd/methodology/m49/).
+ * - If the type is `"script"`, code should be an [ISO-15924 four letters script code](https://unicode.org/iso15924/iso15924-codes.html).
+ * - If the type is `"language"`, code should be a `languageCode` ["-" `scriptCode`] ["-" `regionCode` ] *("-" `variant` )
+ * subsequence of the unicode_language_id grammar in [UTS 35's Unicode Language and Locale Identifiers grammar](https://unicode.org/reports/tr35/#Unicode_language_identifier).
+ * `languageCode` is either a two letters ISO 639-1 language code or a three letters ISO 639-2 language code.
+ * - If the type is `"currency"`, code should be a [3-letter ISO 4217 currency code](https://www.iso.org/iso-4217-currency-codes.html).
+ *
+ * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/of).
+ */
+ of(code: string): string;
+ /**
+ * Returns a new object with properties reflecting the locale and style formatting options computed during the construction of the current
+ * [`Intl/DisplayNames`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames) object.
+ *
+ * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/resolvedOptions).
+ */
+ resolvedOptions(): DisplayNamesOptions;
+ }
+
+ /**
+ * The [`Intl.DisplayNames()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames)
+ * object enables the consistent translation of language, region and script display names.
+ *
+ * [Compatibility](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames#browser_compatibility).
+ */
+ const DisplayNames: {
+ prototype: DisplayNames;
+
+ /**
+ * @param locales A string with a BCP 47 language tag, or an array of such strings.
+ * For the general form and interpretation of the `locales` argument, see the [Intl](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locale_identification_and_negotiation)
+ * page.
+ *
+ * @param options An object for setting up a display name.
+ *
+ * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/DisplayNames).
+ */
+ new(locales?: BCP47LanguageTag | BCP47LanguageTag[], options?: Partial<DisplayNamesOptions>): DisplayNames;
+
+ /**
+ * Returns an array containing those of the provided locales that are supported in display names without having to fall back to the runtime's default locale.
+ *
+ * @param locales A string with a BCP 47 language tag, or an array of such strings.
+ * For the general form and interpretation of the `locales` argument, see the [Intl](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locale_identification_and_negotiation)
+ * page.
+ *
+ * @param options An object with a locale matcher.
+ *
+ * @returns An array of strings representing a subset of the given locale tags that are supported in display names without having to fall back to the runtime's default locale.
+ *
+ * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/supportedLocalesOf).
+ */
+ supportedLocalesOf(locales: BCP47LanguageTag | BCP47LanguageTag[], options?: {localeMatcher: RelativeTimeFormatLocaleMatcher}): BCP47LanguageTag[];
+ };
+
}