-
-
Notifications
You must be signed in to change notification settings - Fork 660
Open
Labels
TypesChanges related to the TypeScript definitionsChanges related to the TypeScript definitionsbugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers
Description
Bug Description
type undici.Response cannot be assigned to type Response so that module authors can use globally available Response
as a type but users may use undici
as the implementation to obtain one.
Reproducible By
https://gist.github.com/panva/a350238b643aef7a77b29e6db395c3b9
git clone https://gist.github.com/panva/a350238b643aef7a77b29e6db395c3b9 response-type-reproduction
cd response-type-reproduction
npm i
npx tsc
Expected Behavior
The types should be compatible.
Logs & Screenshots
index.ts:4:3 - error TS2322: Type 'Promise<import("./node_modules/undici/types/fetch").Response>' is not assignable to type 'Promise<Response>'.
Type 'import("./node_modules/undici/types/fetch").Response' is not assignable to type 'Response'.
The types returned by 'headers.entries()' are incompatible between these types.
Type 'SpecIterableIterator<[string, string]>' is missing the following properties from type 'HeadersIterator<[string, string]>': map, filter, take, drop, and 9 more.
4 return undici.fetch(url)
~~~~~~
Found 1 error in index.ts:4
Metadata
Metadata
Assignees
Labels
TypesChanges related to the TypeScript definitionsChanges related to the TypeScript definitionsbugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers