Skip to content

Commit 248a8da

Browse files
feat:
Add initial type for prototype
1 parent b263cc4 commit 248a8da

File tree

1 file changed

+51
-1
lines changed

1 file changed

+51
-1
lines changed

src/lib/esnext.intl.d.ts

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,53 @@
11
declare namespace Intl {
2-
// Empty
2+
interface DurationFormat {
3+
/**
4+
* @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.
5+
*
6+
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DurationFormat/format).
7+
*/
8+
format(duration: Record<"years"|"months"|"weeks"|"days"|"hours"|"minutes"|"seconds"|"milliseconds"|"microseconds"|"nanoseconds",number>): string;
9+
/**
10+
* @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.
11+
*
12+
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DurationFormat/formatToParts).
13+
*/
14+
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"}[];
15+
/**
16+
* Returns a new object with properties reflecting the locale and style formatting options computed during the construction of the current
17+
* [`Intl/DisplayNames`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames) object.
18+
*
19+
* [MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/resolvedOptions).
20+
*/
21+
resolvedOptions(): ResolvedDisplayNamesOptions;
22+
}
23+
24+
const DurationFormat: {
25+
prototype: DurationFormat;
26+
27+
/**
28+
* @param locales A string with a BCP 47 language tag, or an array of such strings.
29+
* 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)
30+
* page.
31+
*
32+
* @param options An object for setting up a display name.
33+
*
34+
* [MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/DisplayNames).
35+
*/
36+
new (locales: LocalesArgument, options: DisplayNamesOptions): DisplayNames;
37+
38+
/**
39+
* 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.
40+
*
41+
* @param locales A string with a BCP 47 language tag, or an array of such strings.
42+
* 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)
43+
* page.
44+
*
45+
* @param options An object with a locale matcher.
46+
*
47+
* @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.
48+
*
49+
* [MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/supportedLocalesOf).
50+
*/
51+
supportedLocalesOf(locales?: LocalesArgument, options?: { localeMatcher?: RelativeTimeFormatLocaleMatcher; }): UnicodeBCP47LocaleIdentifier[];
52+
};
353
}

0 commit comments

Comments
 (0)