Closed
Description
Description
The built-in type for FormData in flow requires that the second argument to the append
method is a string
, Blob
, or File
. This conflicts with the react-native FormDataPart
type defined in
Libraries/Network/FormData.js:
type FormDataPart = {
string: string,
headers: Headers,
} | {
uri: string,
headers: Headers,
name?: string,
type?: string,
};
Flow built-in types:
- FormData: https://github.com/facebook/flow/blob/2278be3ffbc2f5ebb965e91f83fc8d957fc7d779/lib/bom.js#L292-L312
- Blob: https://github.com/facebook/flow/blob/6fa6d02faac2591e38456872aa23b62f6a999eec/lib/dom.js#L12-L22
- File: https://github.com/facebook/flow/blob/6fa6d02faac2591e38456872aa23b62f6a999eec/lib/dom.js#L43-L46
Solution
I have made a similar issue in the flow repository (facebook/flow#3597).
I am not sure the approach to take here. I don't think we want to change the flow built-in type so it may require importing FormData directly from react-native or overwriting the type.
Additional Information
- React Native version: 0.42.3
- Platform: both
- Development Operating System: MacOS
- Dev tools: flow version 0.38.0