Closed jliuhtonen closed 2 months ago
Here is an example of a project not compiling because of the issue fixed in this PR.
This commit adds the needed types until @types/node imports the missing types and adds them to globals. After that, all "Undici" types from the request types should be removed.
Can you open an issue on the TS types repo and add a code comment with the link? I like to know that it will eventually be resolved upstream.
@sindresorhus done, I opened a discussion here: https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/69408
Code comment also added.
When using Ky with Node, TypeScript will run into compilation error regarding types required by
UndiciRequestInit
. This is because@types/node
does not yet provide these types, and they are not imported fromundici-types
either. The latter would not even be possible to keep Ky usable with browsers.This happened to work in the project, because
@sindresorhus/tsconfig
includesDOM
in the libs section. In most Node applications, the DOM lib should not be there and clashes with Node types. One way to circumvent this is to addskipLibCheck: true
totsconfig.json
, but this is not a good solution.This commit adds the needed types until
@types/node
imports the missing types and adds them to globals. After that, all "Undici" types from the request types should be removed.