Uh oh!
There was an error while loading. Please reload this page.
fix(openapi-fetch): don't rely on DOM types - #1827
Conversation
🦋 Changeset detectedLatest commit: 19887b0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
| export type HeadersOptions = | ||
| | HeadersInit | ||
| | Required<RequestInit>["headers"] |
There was a problem hiding this comment.
This change pulls a reference to HeadersInit from RequestInit rather than relying on the global declaration, which only exists in the DOM lib. In projects with the DOM lib, this reference will resolve to HeadersInit declared in lib.dom.d.ts. In projects with Node types and no DOM lib, this reference will resolve to HeadersInit from undici-types/fetch.d.ts as referenced from @types/node/globals.d.ts.
drwpow
left a comment
There was a problem hiding this comment.
Thank you for fixing! I agree with this logic. And here, existing tests will work. Thank you for improving!
Changes
This PR changes typing to avoid the global
HeadersInit, which is declared in the DOM lib and therefore typically not included in Node projects.Resolves#1823
Resolves#1824
Resolves#1735
How to Review
How can a reviewer review your changes? What should be kept in mind for this review?
Checklist
docs/updated (if necessary)pnpm run update:examplesrun (only applicable for openapi-typescript)