sindresorhus / ky

🌳 Tiny & elegant JavaScript HTTP client based on the browser Fetch API
MIT License
11.83k stars 341 forks source link

Cannot find module 'undici-types' or its corresponding type declarations #562

Closed everdimension closed 4 months ago

everdimension commented 4 months ago

I updated from 0.33 to 1.2.1 and seeing this error when bundling my project:

Cannot find module 'undici-types' or its corresponding type declarations.

1 import { type RequestInit as UndiciRequestInit } from 'undici-types';

I see that this dependency is indeed referenced in source code: https://github.com/sindresorhus/ky/blob/58b5c4a50391689e7b55901f8aa23ebe2a401c73/source/types/request.ts#L1

But at the same time it's not present in package dependencies: https://github.com/sindresorhus/ky/blob/58b5c4a50391689e7b55901f8aa23ebe2a401c73/package.json#L56-L76

Why is there a dependency on a third-party package in source code? If it is necessary, ideally it should be bundled into the build so that consumer packages do not need to install a third-party dependency only for types.

Alternatively, if this is the only usage of this type, maybe it can be inlined into the source code?