-
Notifications
You must be signed in to change notification settings - Fork 202
Closed
Description
Unfetch used to declare it's type as typeof fetch
which was working well for us.
Now it uses a custom type, which gives us errors when we try to pass it as a parameter to a function expecting something compatible with fetch
:
$ tsc --noEmit
src/startup/client/fluentd.ts:10:26 - error TS2345: Argument of type 'Unfetch' is not assignable to parameter of type '(input: RequestInfo, init?: RequestInit | undefined) => Promise<Response>'.
Types of parameters 'options' and 'init' are incompatible.
Type 'RequestInit | undefined' is not assignable to type '{ method?: string | undefined; headers?: Record<string, string> | undefined; credentials?: "include" | "omit" | undefined; body?: string | ArrayBuffer | ArrayBufferView | ... 6 more ... | undefined; } | undefined'.
Type 'RequestInit' is not assignable to type '{ method?: string | undefined; headers?: Record<string, string> | undefined; credentials?: "include" | "omit" | undefined; body?: string | ArrayBuffer | ArrayBufferView | ... 6 more ... | undefined; }'.
Types of property 'headers' are incompatible.
Type 'Record<string, string> | Headers | string[][] | undefined' is not assignable to type 'Record<string, string> | undefined'.
Type 'Headers' is not assignable to type 'Record<string, string>'.
Index signature is missing in type 'Headers'.
Metadata
Metadata
Assignees
Labels
No labels