Skip to content

Commit ba6529b

Browse files
committed
react-intl libdef: Make more React type annotations useful.
Following from the previous commit, these are all the ones I'd really feel confident and comfortable doing, above and beyond the ones I expect to be most visible. Plenty of `React.` occurrences remain. Let's fix these carefully if it turns out they're suppressing some really useful type checking, but I don't expect it to be really easy.
1 parent 31e758d commit ba6529b

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

flow-typed/react-intl_vx.x.x.js

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,9 @@ declare module 'react-intl' {
119119
props: any,
120120
) => React.ReactElement<
121121
any,
122-
string | any | ((props: any) => React.Component<any, any, any>),
122+
string | any | ((props: any) => React$Component<any, any, any>),
123123
> | null)
124-
| ((props: any) => React.Component<any, any, any>),
124+
| ((props: any) => React$Component<any, any, any>),
125125
> | null,
126126
...
127127
},
@@ -147,7 +147,7 @@ declare module 'react-intl' {
147147
}
148148
declare export var FormattedList: React.FC<
149149
IntlListFormatOptions & {
150-
value: React.Node[],
150+
value: React$Node[],
151151
...
152152
},
153153
>;
@@ -200,7 +200,7 @@ declare module 'react-intl' {
200200
...
201201
} & React.RefAttributes<any>,
202202
> & {
203-
WrappedComponent: React.ComponentType<Props_2>,
203+
WrappedComponent: React$ComponentType<Props_2>,
204204
...
205205
};
206206
// changed `mixins` to `extends` in Flow to TS translation
@@ -237,9 +237,9 @@ declare module 'react-intl' {
237237
props: any,
238238
) => React.ReactElement<
239239
any,
240-
string | any | ((props: any) => React.Component<any, any, any>),
240+
string | any | ((props: any) => React$Component<any, any, any>),
241241
> | null)
242-
| ((props: any) => React.Component<any, any, any>),
242+
| ((props: any) => React$Component<any, any, any>),
243243
> | null,
244244
...
245245
},
@@ -274,23 +274,23 @@ declare module 'react-intl' {
274274
}
275275
declare type FormatXMLElementFn = (...args: any[]) => string | { [key: string]: any };
276276
declare export function injectIntl<IntlPropName: string, P: WrappedComponentProps<IntlPropName>>(
277-
WrappedComponent: React.ComponentType<P>,
277+
WrappedComponent: React$ComponentType<P>,
278278
options?: Opts<IntlPropName, false>,
279279
): React.FC<WithIntlProps<P>> & {
280-
WrappedComponent: React.ComponentType<P>,
280+
WrappedComponent: React$ComponentType<P>,
281281
...
282282
};
283283
declare export function injectIntl<
284284
IntlPropName: string,
285285
P: WrappedComponentProps<IntlPropName>,
286-
T: React.ComponentType<P>,
286+
T: React$ComponentType<P>,
287287
>(
288-
WrappedComponent: React.ComponentType<P>,
288+
WrappedComponent: React$ComponentType<P>,
289289
options?: Opts<IntlPropName, true>,
290290
): React.ForwardRefExoticComponent<
291291
React.PropsWithoutRef<WithIntlProps<P>> & React.RefAttributes<T>,
292292
> & {
293-
WrappedComponent: React.ComponentType<P>,
293+
WrappedComponent: React$ComponentType<P>,
294294
...
295295
};
296296
declare export interface IntlCache {
@@ -306,7 +306,7 @@ declare module 'react-intl' {
306306
locale: string;
307307
timeZone?: string;
308308
formats: CustomFormats;
309-
textComponent?: React.ComponentType<> | $Keys<React.ReactHTML>;
309+
textComponent?: React$ComponentType<> | $Keys<React.ReactHTML>;
310310
messages: { [key: string]: string, ... } | { [key: string]: MessageFormatElement[], ... };
311311
defaultLocale: string;
312312
defaultFormats: CustomFormats;
@@ -363,9 +363,9 @@ declare module 'react-intl' {
363363
formatHTMLMessage(
364364
descriptor: MessageDescriptor,
365365
values?: { [key: string]: PrimitiveType, ... },
366-
): React.Node,
366+
): React$Node,
367367
formatList(values: Array<string>, opts?: FormatListOptions): string,
368-
formatList(values: Array<string | React.Node>, opts?: FormatListOptions): React.Node,
368+
formatList(values: Array<string | React$Node>, opts?: FormatListOptions): React$Node,
369369
formatDisplayName(
370370
value: $ElementType<Parameters<$PropertyType<DisplayNames, 'of'>>, 0>,
371371
opts?: FormatDisplayNameOptions,
@@ -709,19 +709,19 @@ declare module 'react-intl' {
709709
declare type Props_2 = {
710710
value: number,
711711
intl: IntlShape,
712-
other: React.Node,
713-
zero?: React.Node,
714-
one?: React.Node,
715-
two?: React.Node,
716-
few?: React.Node,
717-
many?: React.Node,
718-
children?: (value: React.Node) => React.ReactElement<> | null,
712+
other: React$Node,
713+
zero?: React$Node,
714+
one?: React$Node,
715+
two?: React$Node,
716+
few?: React$Node,
717+
many?: React$Node,
718+
children?: (value: React$Node) => React.ReactElement<> | null,
719719
...
720720
} & FormatPluralOptions;
721-
declare type Props_3<V: { [key: string]: any, ... } = { [key: string]: React.Node, ... }> = {
721+
declare type Props_3<V: { [key: string]: any, ... } = { [key: string]: React$Node, ... }> = {
722722
values?: V,
723723
tagName?: React.ElementType<any>,
724-
children?: (...nodes: React.ReactNodeArray) => React.Node,
724+
children?: (...nodes: React.ReactNodeArray) => React$Node,
725725
...
726726
} & MessageDescriptor;
727727
declare export var RawIntlProvider: React.Provider<IntlShape>;

0 commit comments

Comments
 (0)