Skip to content

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

Description

@michaelgmcd

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions