Skip to content

Commit e6f20da

Browse files
flow-typed: fix unresolved types (#2962)
1 parent 3f6034a commit e6f20da

File tree

2 files changed

+197
-1
lines changed

2 files changed

+197
-1
lines changed

flow-typed/intl.js

Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
/**
2+
* Copyright (c) Facebook, Inc. and its affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
declare var Intl: {
9+
Collator: Class<Intl$Collator>,
10+
DateTimeFormat: Class<Intl$DateTimeFormat>,
11+
NumberFormat: Class<Intl$NumberFormat>,
12+
PluralRules: ?Class<Intl$PluralRules>,
13+
getCanonicalLocales?: (locales?: Intl$Locales) => Intl$Locale[],
14+
...
15+
}
16+
17+
type Intl$Locale = string
18+
type Intl$Locales = Intl$Locale | Intl$Locale[]
19+
20+
declare class Intl$Collator {
21+
constructor (
22+
locales?: Intl$Locales,
23+
options?: Intl$CollatorOptions
24+
): Intl$Collator;
25+
26+
static (
27+
locales?: Intl$Locales,
28+
options?: Intl$CollatorOptions
29+
): Intl$Collator;
30+
31+
compare (string, string): number;
32+
33+
resolvedOptions (): {
34+
locale: Intl$Locale,
35+
usage: 'sort' | 'search',
36+
sensitivity: 'base' | 'accent' | 'case' | 'variant',
37+
ignorePunctuation: boolean,
38+
collation: string,
39+
numeric: boolean,
40+
caseFirst?: 'upper' | 'lower' | 'false',
41+
...
42+
};
43+
44+
static supportedLocalesOf (locales?: Intl$Locales): Intl$Locale[];
45+
}
46+
47+
declare type Intl$CollatorOptions = {
48+
localeMatcher?: 'lookup' | 'best fit',
49+
usage?: 'sort' | 'search',
50+
sensitivity?: 'base' | 'accent' | 'case' | 'variant',
51+
ignorePunctuation?: boolean,
52+
numeric?: boolean,
53+
caseFirst?: 'upper' | 'lower' | 'false',
54+
...
55+
}
56+
57+
type FormatToPartsType = | 'day' | 'dayPeriod' | 'era' | 'hour' | 'literal'
58+
| 'minute' | 'month' | 'second' | 'timeZoneName' | 'weekday' | 'year';
59+
60+
declare class Intl$DateTimeFormat {
61+
constructor (
62+
locales?: Intl$Locales,
63+
options?: Intl$DateTimeFormatOptions
64+
): Intl$DateTimeFormat;
65+
66+
static (
67+
locales?: Intl$Locales,
68+
options?: Intl$DateTimeFormatOptions
69+
): Intl$DateTimeFormat;
70+
71+
format (value?: Date | number): string;
72+
73+
formatToParts (value?: Date | number): Array<{
74+
type: FormatToPartsType,
75+
value: string,
76+
...
77+
}>;
78+
79+
resolvedOptions (): {
80+
locale: Intl$Locale,
81+
calendar: string,
82+
numberingSystem: string,
83+
timeZone?: string,
84+
hour12: boolean,
85+
weekday?: 'narrow' | 'short' | 'long',
86+
era?: 'narrow' | 'short' | 'long',
87+
year?: 'numeric' | '2-digit',
88+
month?: 'numeric' | '2-digit' | 'narrow' | 'short' | 'long',
89+
day?: 'numeric' | '2-digit',
90+
hour?: 'numeric' | '2-digit',
91+
minute?: 'numeric' | '2-digit',
92+
second?: 'numeric' | '2-digit',
93+
timeZoneName?: 'short' | 'long',
94+
...
95+
};
96+
97+
static supportedLocalesOf (locales?: Intl$Locales): Intl$Locale[];
98+
}
99+
100+
declare type Intl$DateTimeFormatOptions = {
101+
localeMatcher?: 'lookup' | 'best fit',
102+
timeZone?: string,
103+
hour12?: boolean,
104+
formatMatcher?: 'basic' | 'best fit',
105+
weekday?: 'narrow' | 'short' | 'long',
106+
era?: 'narrow' | 'short' | 'long',
107+
year?: 'numeric' | '2-digit',
108+
month?: 'numeric' | '2-digit' | 'narrow' | 'short' | 'long',
109+
day?: 'numeric' | '2-digit',
110+
hour?: 'numeric' | '2-digit',
111+
minute?: 'numeric' | '2-digit',
112+
second?: 'numeric' | '2-digit',
113+
timeZoneName?: 'short' | 'long',
114+
...
115+
}
116+
117+
declare class Intl$NumberFormat {
118+
constructor (
119+
locales?: Intl$Locales,
120+
options?: Intl$NumberFormatOptions
121+
): Intl$NumberFormat;
122+
123+
static (
124+
locales?: Intl$Locales,
125+
options?: Intl$NumberFormatOptions
126+
): Intl$NumberFormat;
127+
128+
format (number): string;
129+
130+
resolvedOptions (): {
131+
locale: Intl$Locale,
132+
numberingSystem: string,
133+
style: 'decimal' | 'currency' | 'percent',
134+
currency?: string,
135+
currencyDisplay?: 'symbol' | 'code' | 'name',
136+
useGrouping: boolean,
137+
minimumIntegerDigits?: number,
138+
minimumFractionDigits?: number,
139+
maximumFractionDigits?: number,
140+
minimumSignificantDigits?: number,
141+
maximumSignificantDigits?: number,
142+
...
143+
};
144+
145+
static supportedLocalesOf (locales?: Intl$Locales): Intl$Locale[];
146+
}
147+
148+
declare type Intl$NumberFormatOptions = {
149+
localeMatcher?: 'lookup' | 'best fit',
150+
style?: 'decimal' | 'currency' | 'percent',
151+
currency?: string,
152+
currencyDisplay?: 'symbol' | 'code' | 'name',
153+
useGrouping?: boolean,
154+
minimumIntegerDigits?: number,
155+
minimumFractionDigits?: number,
156+
maximumFractionDigits?: number,
157+
minimumSignificantDigits?: number,
158+
maximumSignificantDigits?: number,
159+
...
160+
}
161+
162+
declare class Intl$PluralRules {
163+
constructor (
164+
locales?: Intl$Locales,
165+
options?: Intl$PluralRulesOptions
166+
): Intl$PluralRules;
167+
168+
select (number): Intl$PluralRule;
169+
170+
resolvedOptions (): {
171+
locale: Intl$Locale,
172+
type: 'cardinal' | 'ordinal',
173+
minimumIntegerDigits?: number,
174+
minimumFractionDigits?: number,
175+
maximumFractionDigits?: number,
176+
minimumSignificantDigits?: number,
177+
maximumSignificantDigits?: number,
178+
pluralCategories: Intl$PluralRule[],
179+
...
180+
};
181+
182+
static supportedLocalesOf (locales?: Intl$Locales): Intl$Locale[];
183+
}
184+
185+
type Intl$PluralRule = 'zero' | 'one' | 'two' | 'few' | 'many' | 'other'
186+
187+
declare type Intl$PluralRulesOptions = {
188+
localeMatcher?: 'lookup' | 'best fit',
189+
type?: 'cardinal' | 'ordinal',
190+
minimumIntegerDigits?: number,
191+
minimumFractionDigits?: number,
192+
maximumFractionDigits?: number,
193+
minimumSignificantDigits?: number,
194+
maximumSignificantDigits?: number,
195+
...
196+
}

flow-typed/node.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
declare class Process extends events$EventEmitter {
1+
declare class Process {
22
env : { [key: string] : string | void, ... };
33
}
44

0 commit comments

Comments
 (0)