-
Notifications
You must be signed in to change notification settings - Fork 545
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
Fetch types are incompatible with "lib/dom" definitions #1943
Comments
Would you like to send in a PR to add the missing propert(y/ies) to Request? |
@KhafraDev, absolutely! Will open a pull request tomorrow, we can follow up there. Thanks for a quick response on this. |
Hey, @KhafraDev. I've opened a draft to improve typings of Undici. Would appreciate an early review of this and any potential discussion. Thanks. |
It is interesting that this bug is not yet fixed. Can we do any help? |
This updates all dependencies in the repo. Note: Svelte was reverted because the Undici update breaks tsc compilation due to an issue with Undici's types for `Request` and our usage of a custom fetch. See issue here: nodejs/undici#1943
PRs are welcome! |
Isn't #1964 already open? |
Actually it's abandoned with failing tests. A fresh one would be better. |
Bug Description
The
Request
interface exposed by Undici does not satisfy the same type from the global type definitions (lib/dom
), and also missing properties according to the Fetch API specification:undici/types/fetch.d.ts
Line 138 in d8d9a96
Reproducible By
As an example, consider the following code:
The
referrer
property is not present in the Undici'sRequest
type definition while it's both required inlib/dom
definitions and the Fetch API specification.Expected Behavior
Fetch API primitives such as Request, Response and Headers, are compatible with the global
Logs & Screenshots
No applicable logs.
Environment
Additional context
I understand that I'm setting
lib/dom
as the source of truth here but I expect that shouldn't matter since:lib/node
aim to implement the Fetch API specification.referrer
.Also, for context, I'm spotting this while building Interceptors (mswjs/interceptors#340) where I try using Undici as a Fetch polyfill to guarantee fetch primitives can be created in Node versions prior to global fetch.
I'd like to open a pull request to ensure this compliance after discussing this with the maintainers of this lib.
The text was updated successfully, but these errors were encountered: