You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The createSignedFetcher shouldn't be overly strict with what the arguments and return value the custom implementation has. It should also be generic so that the return type of createSignedFetcher is the same type as SignedFetcherOptions["fetch"]:
constsignedFetch=createSignedFetcher({
region,
credentials,service: "service",fetch: undiciFetch,});// signedFetch is typeof undiciFetch
The text was updated successfully, but these errors were encountered:
Hey @u873838 thanks for bringing this to my attention. I actually didn't think there would be any type issue, because this library is using the official fetch types from TypeScript DOM lib and unidici implements the Fetch standard.
I'll see what I can do and will come back to you soon!
You would think, but this is the error that I get when trying to use undici as the fetch option:
file.ts:10:7 - error TS2322: Type '(input: RequestInfo, init?: RequestInit | undefined) => Promise<Response>' is not assignable to type '(input: string | URL | Request, init?: RequestInit | undefined) => Promise<Response>'.
Types of parameters 'input' and 'input' are incompatible.
Type 'string | URL | Request' is not assignable to type 'RequestInfo'.
Type 'Request' is not assignable to type 'RequestInfo'.
Property 'referrer' is missing in type 'import("<project>/node_modules/undici-types/fetch").Request' but required in type 'import("<project>/node_modules/undici/types/fetch").Request'.
64 fetch: undiciFetch,
~~~~~
node_modules/undici/types/fetch.d.ts:166:12
166 readonly referrer: string
~~~~~~~~
'referrer' is declared here.
node_modules/aws-sigv4-fetch/dist/index.d.cts:7:5
7 fetch?: typeof fetch;
~~~~~
The expected type comes from property 'fetch' which is declared here on type 'SignedFetcherOptions'
The current TypeScript typing information makes it difficult to use a custom
fetch
implementation with certain libraries e.g. undici.The
createSignedFetcher
shouldn't be overly strict with what the arguments and return value the custom implementation has. It should also be generic so that the return type ofcreateSignedFetcher
is the same type asSignedFetcherOptions["fetch"]
:The text was updated successfully, but these errors were encountered: