-
Notifications
You must be signed in to change notification settings - Fork 163
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
fix(typescript): Remove node-fetch in TypeScript SDK #5476
base: main
Are you sure you want to change the base?
Conversation
@remorses this change will require some discussion on our end because there may be breaking changes related to file download and upload endpoints (where the current generated SDKs leverage cc @Swimburger |
The global fetch should already be used by default if available, this means that features like upload already work with it |
@@ -48,7 +47,6 @@ describe("Multipart Form Data Tests", () => { | |||
|
|||
await fdw.appendFile("file", new Blob([new Uint8Array(y)]), "asda"); | |||
|
|||
const fetch = await getFetchFn(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the main change
@@ -19,7 +19,7 @@ export interface CrossPlatformFormData { | |||
|
|||
appendFile(key: string, value: unknown, fileName?: string): Promise<void>; | |||
|
|||
getRequest(): MaybePromise<FormDataRequest<unknown>>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We usually use unknown
instead of any
. Any reason why this was changed here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, now fetch type is more strict and no longer accepts a RequestInit<unknown>
so many type checks in tests for example fail
That unknown has no reason to exist because there is no way to override it with a generic
Description
Removes node-fetch, Node.js 18 already comes with fetch global, Node 18 is the oldest version currently supported.
This change makes it possible to bundle the generated sdk for browser with bundlers like Vite and Rollup without marking node-fetch external
Fix #5468
Changes Made
Remove node-fetch
Testing