1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 | declare namespace Intl {
|
22 |
|
23 |
|
24 | type LDMLPluralRule = "zero" | "one" | "two" | "few" | "many" | "other";
|
25 | type PluralRuleType = "cardinal" | "ordinal";
|
26 |
|
27 | interface PluralRulesOptions {
|
28 | localeMatcher?: "lookup" | "best fit" | undefined;
|
29 | type?: PluralRuleType | undefined;
|
30 | minimumIntegerDigits?: number | undefined;
|
31 | minimumFractionDigits?: number | undefined;
|
32 | maximumFractionDigits?: number | undefined;
|
33 | minimumSignificantDigits?: number | undefined;
|
34 | maximumSignificantDigits?: number | undefined;
|
35 | }
|
36 |
|
37 | interface ResolvedPluralRulesOptions {
|
38 | locale: string;
|
39 | pluralCategories: LDMLPluralRule[];
|
40 | type: PluralRuleType;
|
41 | minimumIntegerDigits: number;
|
42 | minimumFractionDigits: number;
|
43 | maximumFractionDigits: number;
|
44 | minimumSignificantDigits?: number;
|
45 | maximumSignificantDigits?: number;
|
46 | }
|
47 |
|
48 | interface PluralRules {
|
49 | resolvedOptions(): ResolvedPluralRulesOptions;
|
50 | select(n: number): LDMLPluralRule;
|
51 | }
|
52 |
|
53 | const PluralRules: {
|
54 | new (locales?: string | string[], options?: PluralRulesOptions): PluralRules;
|
55 | (locales?: string | string[], options?: PluralRulesOptions): PluralRules;
|
56 |
|
57 | supportedLocalesOf(locales: string | string[], options?: { localeMatcher?: "lookup" | "best fit" }): string[];
|
58 | };
|
59 |
|
60 |
|
61 | type ES2018NumberFormatPartType = "literal" | "nan" | "infinity" | "percent" | "integer" | "group" | "decimal" | "fraction" | "plusSign" | "minusSign" | "percentSign" | "currency" | "code" | "symbol" | "name";
|
62 | type ES2020NumberFormatPartType = "compact" | "exponentInteger" | "exponentMinusSign" | "exponentSeparator" | "unit" | "unknown";
|
63 | type NumberFormatPartTypes = ES2018NumberFormatPartType | ES2020NumberFormatPartType;
|
64 |
|
65 | interface NumberFormatPart {
|
66 | type: NumberFormatPartTypes;
|
67 | value: string;
|
68 | }
|
69 |
|
70 | interface NumberFormat {
|
71 | formatToParts(number?: number | bigint): NumberFormatPart[];
|
72 | }
|
73 | }
|