React-native: [Flow] react-native FormDataPart type conflicts with built-in FormData types in flow

Created on 28 Mar 2017  路  3Comments  路  Source: facebook/react-native

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:

Solution

I have made a similar issue in the flow repository (https://github.com/facebook/flow/issues/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
Flow Locked Discussion

Most helpful comment

Issue was labeled as stale, however as of latest react-native version, this is still an issue.

All 3 comments

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "For Discussion" or "Good first issue" and I will leave it open. Thank you for your contributions.

Issue was labeled as stale, however as of latest react-native version, this is still an issue.

As of today, the second argument of append inside of React Native is typed as FormDataValue (not FormDataPart) which is typed as any so it shouldn't conflict with any typings from Flow.

Was this page helpful?
0 / 5 - 0 ratings