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

Export RequestInit interface #121

Merged
merged 2 commits into from
Sep 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/isomorphic-unfetch/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@ import {
Body as NodeBody,
Headers as NodeHeaders,
Request as NodeRequest,
Response as NodeResponse
Response as NodeResponse,
RequestInit as NodeRequestInit
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unfetch doesn't support RequestInit, so exporting this from isomorphic-unfetch makes the interfaces incompatible depending on environment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah bummer. I guess close this PR then...

} from "node-fetch";

declare namespace unfetch {
export type IsomorphicHeaders = Headers | NodeHeaders;
export type IsomorphicBody = Body | NodeBody;
export type IsomorphicResponse = Response | NodeResponse;
export type IsomorphicRequest = Request | NodeRequest
export type IsomorphicRequest = Request | NodeRequest;
export type IsomorphicRequestInit = RequestInit | NodeRequestInit;
}

declare const unfetch: typeof fetch;
Expand Down
6 changes: 4 additions & 2 deletions src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@ import {
Body as NodeBody,
Headers as NodeHeaders,
Request as NodeRequest,
Response as NodeResponse
Response as NodeResponse,
RequestInit as NodeRequestInit
} from "node-fetch";

declare namespace unfetch {
export type IsomorphicHeaders = Headers | NodeHeaders;
export type IsomorphicBody = Body | NodeBody;
export type IsomorphicResponse = Response | NodeResponse;
export type IsomorphicRequest = Request | NodeRequest
export type IsomorphicRequest = Request | NodeRequest;
export type IsomorphicRequestInit = RequestInit | NodeRequestInit;
}

type UnfetchResponse = {
Expand Down