Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

react-native FormData conflicts with built-in type #3597

Closed
michaelgmcd opened this issue Mar 28, 2017 · 2 comments
Closed

react-native FormData conflicts with built-in type #3597

michaelgmcd opened this issue Mar 28, 2017 · 2 comments

Comments

@michaelgmcd
Copy link

michaelgmcd commented Mar 28, 2017

In react-native, the FormData implementation is a bit different than it is in the browser, meaning the type of the part passed to FormData.append is not a string, Blob, or File. Instead it is the following:

type FormDataPart = {
  string: string,
  headers: Headers,
} | {
  uri: string,
  headers: Headers,
  name?: string,
  type?: string,
};

https://github.com/facebook/react-native/blob/34edf92cbf1dbf7a71c9140921ac4d5e88122622/Libraries/Network/FormData.js#L18-L26

How should I approach typing this in my project?

@nmn
Copy link
Contributor

nmn commented Mar 29, 2017

A type declaration to override the type should work.

@samwgoldman
Copy link
Member

I think this is a better question for the React Native folks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants