From 248a8da7f93d246abce16ea6add094aed8e88ced Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=80=E1=85=B5=E1=86=B7=E1=84=89=E1=85=A1=E1=86=BC?= =?UTF-8?q?=E1=84=83=E1=85=AE?= Date: Sun, 1 Dec 2024 23:30:28 +0900 Subject: [PATCH 1/5] feat: Add initial type for prototype --- src/lib/esnext.intl.d.ts | 52 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/src/lib/esnext.intl.d.ts b/src/lib/esnext.intl.d.ts index 9aacedd724469..0345c9ef9791c 100644 --- a/src/lib/esnext.intl.d.ts +++ b/src/lib/esnext.intl.d.ts @@ -1,3 +1,53 @@ declare namespace Intl { - // Empty + interface DurationFormat { + /** + * @param duration The duration object to be formatted. It should include some or all of the following properties: months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds. + * + * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DurationFormat/format). + */ + format(duration: Record<"years"|"months"|"weeks"|"days"|"hours"|"minutes"|"seconds"|"milliseconds"|"microseconds"|"nanoseconds",number>): string; + /** + * @param duration The duration object to be formatted. It should include some or all of the following properties: months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds. + * + * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DurationFormat/formatToParts). + */ + formatToParts(duration: Record<"years"|"months"|"weeks"|"days"|"hours"|"minutes"|"seconds"|"milliseconds"|"microseconds"|"nanoseconds",number>): {type:"integer"|"literal"|"unit",value:string,unit:"years"|"months"|"weeks"|"days"|"hours"|"minutes"|"seconds"|"milliseconds"|"microseconds"|"nanoseconds"}[]; + /** + * 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/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames) object. + * + * [MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/resolvedOptions). + */ + resolvedOptions(): ResolvedDisplayNamesOptions; + } + + const DurationFormat: { + prototype: DurationFormat; + + /** + * @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/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/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/DisplayNames). + */ + new (locales: LocalesArgument, options: 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/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/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/supportedLocalesOf). + */ + supportedLocalesOf(locales?: LocalesArgument, options?: { localeMatcher?: RelativeTimeFormatLocaleMatcher; }): UnicodeBCP47LocaleIdentifier[]; + }; } From 6ea4d9b81c85cd121a149e6be6633a0dedb9c16e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=80=E1=85=B5=E1=86=B7=E1=84=89=E1=85=A1=E1=86=BC?= =?UTF-8?q?=E1=84=83=E1=85=AE?= Date: Mon, 2 Dec 2024 23:06:07 +0900 Subject: [PATCH 2/5] fix: common type to localeMatcher --- src/lib/es2020.intl.d.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lib/es2020.intl.d.ts b/src/lib/es2020.intl.d.ts index 5ab347994647e..3ab784689067c 100644 --- a/src/lib/es2020.intl.d.ts +++ b/src/lib/es2020.intl.d.ts @@ -56,7 +56,7 @@ declare namespace Intl { * * [MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_negotiation). */ - type RelativeTimeFormatLocaleMatcher = "lookup" | "best fit"; + type LocaleMatcher = "lookup" | "best fit"; /** * The format of output message. @@ -87,7 +87,7 @@ declare namespace Intl { */ 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; + localeMatcher?: LocaleMatcher; /** The format of output message. */ numeric?: RelativeTimeFormatNumeric; /** The length of the internationalized message. */ @@ -352,7 +352,7 @@ declare namespace Intl { | "standard"; interface DisplayNamesOptions { - localeMatcher?: RelativeTimeFormatLocaleMatcher; + localeMatcher?: LocaleMatcher; style?: RelativeTimeFormatStyle; type: DisplayNamesType; languageDisplay?: DisplayNamesLanguageDisplay; @@ -426,7 +426,7 @@ declare namespace Intl { * * [MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/supportedLocalesOf). */ - supportedLocalesOf(locales?: LocalesArgument, options?: { localeMatcher?: RelativeTimeFormatLocaleMatcher; }): UnicodeBCP47LocaleIdentifier[]; + supportedLocalesOf(locales?: LocalesArgument, options?: { localeMatcher?: LocaleMatcher; }): UnicodeBCP47LocaleIdentifier[]; }; interface CollatorConstructor { @@ -451,6 +451,6 @@ declare namespace Intl { new (locales?: LocalesArgument, options?: PluralRulesOptions): PluralRules; (locales?: LocalesArgument, options?: PluralRulesOptions): PluralRules; - supportedLocalesOf(locales: LocalesArgument, options?: { localeMatcher?: "lookup" | "best fit"; }): string[]; + supportedLocalesOf(locales: LocalesArgument, options?: { localeMatcher?: LocaleMatcher; }): string[]; } } From 9aaf3cf46b3c0ef21393120c7439e2ef3098e6b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=80=E1=85=B5=E1=86=B7=E1=84=89=E1=85=A1=E1=86=BC?= =?UTF-8?q?=E1=84=83=E1=85=AE?= Date: Mon, 2 Dec 2024 23:06:23 +0900 Subject: [PATCH 3/5] feat: fill durationFormat type --- src/lib/esnext.intl.d.ts | 120 +++++++++++++++++++++++++++++++++++---- 1 file changed, 108 insertions(+), 12 deletions(-) diff --git a/src/lib/esnext.intl.d.ts b/src/lib/esnext.intl.d.ts index 0345c9ef9791c..de119b6eec9f1 100644 --- a/src/lib/esnext.intl.d.ts +++ b/src/lib/esnext.intl.d.ts @@ -1,24 +1,120 @@ declare namespace Intl { + + /** + * Value of the `unit` property in duration objects + * + * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DurationFormat/format#duration). + */ + type DurationTimeFormatUnit = "years"|"months"|"weeks"|"days"|"hours"|"minutes"|"seconds"|"milliseconds"|"microseconds"|"nanoseconds" + + type DurationFormatStyle = "long" | "short" | "narrow" | "digital" + + + type DurationFormatUnitSingular = + | "year" + | "quarter" + | "month" + | "week" + | "day" + | "hour" + | "minute" + | "second"; + + /** + * An object representing the relative time format in parts + * 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). + */ + type DurationFormatPart = + | { + type: "literal"; + value: string; + } + | { + type: Exclude; + value: string; + unit: DurationFormatUnitSingular; + }; + + type ResolvedDurationFormatOptions = { + locale: UnicodeBCP47LocaleIdentifier + numberingSystem: DateTimeFormatOptions["numberingSystem"] + style: DurationFormatStyle + years: "long"|"short"|"narrow"; + yearsDisplay:"always"|"auto"; + months:"long"|"short"|"narrow"; + monthsDisplay:"always"|"auto"; + weeks:"long"|"short"|"narrow"; + weeksDisplay:"always"|"auto"; + days:"long"|"short"|"narrow"; + daysDisplay:"always"|"auto"; + hours:"long"|"short"|"narrow"|"numeric"|"2-digit" + hoursDisplay:"always"|"auto"; + minutes:"long"|"short"|"narrow"|"numeric"|"2-digit" + minutesDisplay:"always"|"auto"; + seconds:"long"|"short"|"narrow"|"numeric"|"2-digit" + secondsDisplay:"always"|"auto"; + milliseconds:"long"|"short"|"narrow"|"numeric"|"2-digit" + millisecondsDisplay:"always"|"auto"; + microseconds:"long"|"short"|"narrow"|"numeric"|"2-digit" + microsecondsDisplay:"always"|"auto"; + nanosecond:"long"|"short"|"narrow"|"numeric"|"2-digit" + nanosecondDisplay:"always"|"auto"; + fractionalDigits:0|1|2|3|4|5|6|7|8|9 + } + + type DurationFormatOptions = { + localeMatcher: LocaleMatcher + numberingSystem: DateTimeFormatOptions["numberingSystem"] + style: DurationFormatStyle + years: "long"|"short"|"narrow"; + yearsDisplay:"always"|"auto"; + months:"long"|"short"|"narrow"; + monthsDisplay:"always"|"auto"; + weeks:"long"|"short"|"narrow"; + weeksDisplay:"always"|"auto"; + days:"long"|"short"|"narrow"; + daysDisplay:"always"|"auto"; + hours:"long"|"short"|"narrow"|"numeric"|"2-digit" + hoursDisplay:"always"|"auto"; + minutes:"long"|"short"|"narrow"|"numeric"|"2-digit" + minutesDisplay:"always"|"auto"; + seconds:"long"|"short"|"narrow"|"numeric"|"2-digit" + secondsDisplay:"always"|"auto"; + milliseconds:"long"|"short"|"narrow"|"numeric"|"2-digit" + millisecondsDisplay:"always"|"auto"; + microseconds:"long"|"short"|"narrow"|"numeric"|"2-digit" + microsecondsDisplay:"always"|"auto"; + nanosecond:"long"|"short"|"narrow"|"numeric"|"2-digit" + nanosecondDisplay:"always"|"auto"; + fractionalDigits:0|1|2|3|4|5|6|7|8|9 + } + + /** + * The duration object to be formatted + * + * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DurationFormat/format#duration). + */ + type DurationType = Record + interface DurationFormat { /** * @param duration The duration object to be formatted. It should include some or all of the following properties: months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds. * * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DurationFormat/format). */ - format(duration: Record<"years"|"months"|"weeks"|"days"|"hours"|"minutes"|"seconds"|"milliseconds"|"microseconds"|"nanoseconds",number>): string; + format(duration: DurationType): string; /** * @param duration The duration object to be formatted. It should include some or all of the following properties: months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds. * * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DurationFormat/formatToParts). */ - formatToParts(duration: Record<"years"|"months"|"weeks"|"days"|"hours"|"minutes"|"seconds"|"milliseconds"|"microseconds"|"nanoseconds",number>): {type:"integer"|"literal"|"unit",value:string,unit:"years"|"months"|"weeks"|"days"|"hours"|"minutes"|"seconds"|"milliseconds"|"microseconds"|"nanoseconds"}[]; + formatToParts(duration: DurationType): DurationFormatPart; /** - * 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/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames) object. - * - * [MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/resolvedOptions). + * [MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl/DurationFormat/resolvedOptions). */ - resolvedOptions(): ResolvedDisplayNamesOptions; + resolvedOptions(): ResolvedDurationFormatOptions; } const DurationFormat: { @@ -29,11 +125,11 @@ declare namespace Intl { * For the general form and interpretation of the `locales` argument, see the [Intl](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl#locale_identification_and_negotiation) * page. * - * @param options An object for setting up a display name. + * @param options An object for setting up a duration format. * - * [MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/DisplayNames). + * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DurationFormat/DurationFormat). */ - new (locales: LocalesArgument, options: DisplayNamesOptions): DisplayNames; + new (locales: LocalesArgument, options: DurationFormatOptions): 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. @@ -46,8 +142,8 @@ declare namespace Intl { * * @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/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/supportedLocalesOf). + * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DurationFormat/supportedLocalesOf). */ - supportedLocalesOf(locales?: LocalesArgument, options?: { localeMatcher?: RelativeTimeFormatLocaleMatcher; }): UnicodeBCP47LocaleIdentifier[]; + supportedLocalesOf(locales?: LocalesArgument, options?: { localeMatcher?: LocaleMatcher; }): UnicodeBCP47LocaleIdentifier[]; }; } From c2e6abcea7163f0f1fb7b4e2a3de14a352c94f1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=80=E1=85=B5=E1=86=B7=E1=84=89=E1=85=A1=E1=86=BC?= =?UTF-8?q?=E1=84=83=E1=85=AE?= Date: Sun, 8 Dec 2024 17:06:34 +0900 Subject: [PATCH 4/5] feat: format type --- src/lib/esnext.intl.d.ts | 129 ++++++++++++++++++++++----------------- 1 file changed, 74 insertions(+), 55 deletions(-) diff --git a/src/lib/esnext.intl.d.ts b/src/lib/esnext.intl.d.ts index de119b6eec9f1..42e1e5bd905de 100644 --- a/src/lib/esnext.intl.d.ts +++ b/src/lib/esnext.intl.d.ts @@ -6,10 +6,15 @@ declare namespace Intl { * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DurationFormat/format#duration). */ type DurationTimeFormatUnit = "years"|"months"|"weeks"|"days"|"hours"|"minutes"|"seconds"|"milliseconds"|"microseconds"|"nanoseconds" - + + /** + * The style of the formatted duration. + * + * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DurationFormat/DurationFormat#style). + */ type DurationFormatStyle = "long" | "short" | "narrow" | "digital" - + type DurationFormatUnitSingular = | "year" | "quarter" @@ -24,7 +29,7 @@ declare namespace Intl { * An object representing the relative time format in parts * 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). + * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DurationFormat/formatToParts#examples). */ type DurationFormatPart = | { @@ -37,58 +42,72 @@ declare namespace Intl { unit: DurationFormatUnitSingular; }; - type ResolvedDurationFormatOptions = { - locale: UnicodeBCP47LocaleIdentifier - numberingSystem: DateTimeFormatOptions["numberingSystem"] - style: DurationFormatStyle - years: "long"|"short"|"narrow"; - yearsDisplay:"always"|"auto"; - months:"long"|"short"|"narrow"; - monthsDisplay:"always"|"auto"; - weeks:"long"|"short"|"narrow"; - weeksDisplay:"always"|"auto"; - days:"long"|"short"|"narrow"; - daysDisplay:"always"|"auto"; - hours:"long"|"short"|"narrow"|"numeric"|"2-digit" - hoursDisplay:"always"|"auto"; - minutes:"long"|"short"|"narrow"|"numeric"|"2-digit" - minutesDisplay:"always"|"auto"; - seconds:"long"|"short"|"narrow"|"numeric"|"2-digit" - secondsDisplay:"always"|"auto"; - milliseconds:"long"|"short"|"narrow"|"numeric"|"2-digit" - millisecondsDisplay:"always"|"auto"; - microseconds:"long"|"short"|"narrow"|"numeric"|"2-digit" - microsecondsDisplay:"always"|"auto"; - nanosecond:"long"|"short"|"narrow"|"numeric"|"2-digit" - nanosecondDisplay:"always"|"auto"; - fractionalDigits:0|1|2|3|4|5|6|7|8|9 + + + type DurationFormatOptions = "long"|"short"|"narrow"|"numeric"|"2-digit" + + + type DurationFormatDisplayOption = "always"|"auto"; + + /** + * Number of how many fractional second digits to display in the output. + * + * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DurationFormat/DurationFormat#fractionaldigits). + */ + type fractionalDigitsOption = 0|1|2|3|4|5|6|7|8|9 + + interface ResolvedDurationFormatOptions { + locale?: UnicodeBCP47LocaleIdentifier + numberingSystem?: DateTimeFormatOptions["numberingSystem"] + style?: DurationFormatStyle + years?: Omit + yearsDisplay?:DurationFormatDisplayOption + months?: Omit + monthsDisplay?: DurationFormatDisplayOption + weeks?: Omit + weeksDisplay?: DurationFormatDisplayOption + days?: Omit + daysDisplay?: DurationFormatDisplayOption + hours?: DurationFormatOptions + hoursDisplay?: DurationFormatDisplayOption + minutes?: DurationFormatOptions + minutesDisplay?: DurationFormatDisplayOption + seconds?: DurationFormatOptions + secondsDisplay?: DurationFormatDisplayOption + milliseconds?: DurationFormatOptions + millisecondsDisplay?: DurationFormatDisplayOption + microseconds?: DurationFormatOptions + microsecondsDisplay?: DurationFormatDisplayOption + nanosecond?: DurationFormatOptions + nanosecondDisplay?: DurationFormatDisplayOption + fractionalDigits?: fractionalDigitsOption } - type DurationFormatOptions = { - localeMatcher: LocaleMatcher - numberingSystem: DateTimeFormatOptions["numberingSystem"] - style: DurationFormatStyle - years: "long"|"short"|"narrow"; - yearsDisplay:"always"|"auto"; - months:"long"|"short"|"narrow"; - monthsDisplay:"always"|"auto"; - weeks:"long"|"short"|"narrow"; - weeksDisplay:"always"|"auto"; - days:"long"|"short"|"narrow"; - daysDisplay:"always"|"auto"; - hours:"long"|"short"|"narrow"|"numeric"|"2-digit" - hoursDisplay:"always"|"auto"; - minutes:"long"|"short"|"narrow"|"numeric"|"2-digit" - minutesDisplay:"always"|"auto"; - seconds:"long"|"short"|"narrow"|"numeric"|"2-digit" - secondsDisplay:"always"|"auto"; - milliseconds:"long"|"short"|"narrow"|"numeric"|"2-digit" - millisecondsDisplay:"always"|"auto"; - microseconds:"long"|"short"|"narrow"|"numeric"|"2-digit" - microsecondsDisplay:"always"|"auto"; - nanosecond:"long"|"short"|"narrow"|"numeric"|"2-digit" - nanosecondDisplay:"always"|"auto"; - fractionalDigits:0|1|2|3|4|5|6|7|8|9 + interface DurationFormatOptions { + localeMatcher?: LocaleMatcher + numberingSystem?: DateTimeFormatOptions["numberingSystem"] + style?: DurationFormatStyle + years?: Omit + yearsDisplay?:DurationFormatDisplayOption + months?: Omit + monthsDisplay?: DurationFormatDisplayOption + weeks?: Omit + weeksDisplay?: DurationFormatDisplayOption + days?: Omit + daysDisplay?: DurationFormatDisplayOption + hours?: DurationFormatOptions + hoursDisplay?: DurationFormatDisplayOption + minutes?: DurationFormatOptions + minutesDisplay?: DurationFormatDisplayOption + seconds?: DurationFormatOptions + secondsDisplay?: DurationFormatDisplayOption + milliseconds?: DurationFormatOptions + millisecondsDisplay?: DurationFormatDisplayOption + microseconds?: DurationFormatOptions + microsecondsDisplay?: DurationFormatDisplayOption + nanosecond?: DurationFormatOptions + nanosecondDisplay?: DurationFormatDisplayOption + fractionalDigits?: fractionalDigitsOption } /** @@ -110,7 +129,7 @@ declare namespace Intl { * * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DurationFormat/formatToParts). */ - formatToParts(duration: DurationType): DurationFormatPart; + formatToParts(duration: DurationType): DurationFormatPart[]; /** * [MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl/DurationFormat/resolvedOptions). */ @@ -129,7 +148,7 @@ declare namespace Intl { * * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DurationFormat/DurationFormat). */ - new (locales: LocalesArgument, options: DurationFormatOptions): DisplayNames; + new (locales: LocalesArgument, options: DurationFormatOptions): DurationFormat; /** * 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. From 365881cccdd2ffcca3c51f8ce1c5794a67637770 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=80=E1=85=B5=E1=86=B7=E1=84=89=E1=85=A1=E1=86=BC?= =?UTF-8?q?=E1=84=83=E1=85=AE?= Date: Sat, 21 Dec 2024 21:51:26 +0900 Subject: [PATCH 5/5] fix: type error --- src/lib/es2020.intl.d.ts | 10 +++++----- src/lib/esnext.intl.d.ts | 28 ++++++++++++++-------------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/lib/es2020.intl.d.ts b/src/lib/es2020.intl.d.ts index 3ab784689067c..7b3560a4d7dfd 100644 --- a/src/lib/es2020.intl.d.ts +++ b/src/lib/es2020.intl.d.ts @@ -56,7 +56,7 @@ declare namespace Intl { * * [MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_negotiation). */ - type LocaleMatcher = "lookup" | "best fit"; + type RelativeTimeFormatLocaleMatcher = "lookup" | "best fit"; /** * The format of output message. @@ -87,7 +87,7 @@ declare namespace Intl { */ 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?: LocaleMatcher; + localeMatcher?: RelativeTimeFormatLocaleMatcher; /** The format of output message. */ numeric?: RelativeTimeFormatNumeric; /** The length of the internationalized message. */ @@ -352,7 +352,7 @@ declare namespace Intl { | "standard"; interface DisplayNamesOptions { - localeMatcher?: LocaleMatcher; + localeMatcher?: RelativeTimeFormatLocaleMatcher; style?: RelativeTimeFormatStyle; type: DisplayNamesType; languageDisplay?: DisplayNamesLanguageDisplay; @@ -426,7 +426,7 @@ declare namespace Intl { * * [MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/supportedLocalesOf). */ - supportedLocalesOf(locales?: LocalesArgument, options?: { localeMatcher?: LocaleMatcher; }): UnicodeBCP47LocaleIdentifier[]; + supportedLocalesOf(locales?: LocalesArgument, options?: { localeMatcher?: RelativeTimeFormatLocaleMatcher; }): UnicodeBCP47LocaleIdentifier[]; }; interface CollatorConstructor { @@ -451,6 +451,6 @@ declare namespace Intl { new (locales?: LocalesArgument, options?: PluralRulesOptions): PluralRules; (locales?: LocalesArgument, options?: PluralRulesOptions): PluralRules; - supportedLocalesOf(locales: LocalesArgument, options?: { localeMatcher?: LocaleMatcher; }): string[]; + supportedLocalesOf(locales: LocalesArgument, options?: { localeMatcher?: RelativeTimeFormatLocaleMatcher; }): string[]; } } diff --git a/src/lib/esnext.intl.d.ts b/src/lib/esnext.intl.d.ts index 42e1e5bd905de..4ef282c90a305 100644 --- a/src/lib/esnext.intl.d.ts +++ b/src/lib/esnext.intl.d.ts @@ -1,5 +1,5 @@ declare namespace Intl { - + type DurationTimeFormatLocaleMatcher = "lookup" | "best fit"; /** * Value of the `unit` property in duration objects * @@ -44,7 +44,7 @@ declare namespace Intl { - type DurationFormatOptions = "long"|"short"|"narrow"|"numeric"|"2-digit" + type DurationFormatOption = "long"|"short"|"narrow"|"numeric"|"2-digit" type DurationFormatDisplayOption = "always"|"auto"; @@ -84,28 +84,28 @@ declare namespace Intl { } interface DurationFormatOptions { - localeMatcher?: LocaleMatcher + localeMatcher?: DurationTimeFormatLocaleMatcher numberingSystem?: DateTimeFormatOptions["numberingSystem"] style?: DurationFormatStyle - years?: Omit + years?: Omit yearsDisplay?:DurationFormatDisplayOption - months?: Omit + months?: Omit monthsDisplay?: DurationFormatDisplayOption - weeks?: Omit + weeks?: Omit weeksDisplay?: DurationFormatDisplayOption - days?: Omit + days?: Omit daysDisplay?: DurationFormatDisplayOption - hours?: DurationFormatOptions + hours?: DurationFormatOption hoursDisplay?: DurationFormatDisplayOption - minutes?: DurationFormatOptions + minutes?: DurationFormatOption minutesDisplay?: DurationFormatDisplayOption - seconds?: DurationFormatOptions + seconds?: DurationFormatOption secondsDisplay?: DurationFormatDisplayOption - milliseconds?: DurationFormatOptions + milliseconds?: DurationFormatOption millisecondsDisplay?: DurationFormatDisplayOption - microseconds?: DurationFormatOptions + microseconds?: DurationFormatOption microsecondsDisplay?: DurationFormatDisplayOption - nanosecond?: DurationFormatOptions + nanosecond?: DurationFormatOption nanosecondDisplay?: DurationFormatDisplayOption fractionalDigits?: fractionalDigitsOption } @@ -163,6 +163,6 @@ declare namespace Intl { * * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DurationFormat/supportedLocalesOf). */ - supportedLocalesOf(locales?: LocalesArgument, options?: { localeMatcher?: LocaleMatcher; }): UnicodeBCP47LocaleIdentifier[]; + supportedLocalesOf(locales?: LocalesArgument, options?: { localeMatcher?: DurationTimeFormatLocaleMatcher; }): UnicodeBCP47LocaleIdentifier[]; }; }