Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sign and fetch functions don't *exactly* match TypeScripts' types. #44

Open
adworacz opened this issue Dec 2, 2022 · 0 comments
Open

Comments

@adworacz
Copy link

adworacz commented Dec 2, 2022

aws4fetch/dist/main.d.ts

Lines 20 to 35 in 03f9802

sign(input: RequestInfo, init?: (RequestInit & {
aws?: {
accessKeyId?: string | undefined;
secretAccessKey?: string | undefined;
sessionToken?: string | undefined;
service?: string | undefined;
region?: string | undefined;
cache?: Map<string, ArrayBuffer> | undefined;
datetime?: string | undefined;
signQuery?: boolean | undefined;
appendSessionToken?: boolean | undefined;
allHeaders?: boolean | undefined;
singleEncode?: boolean | undefined;
} | undefined;
}) | null | undefined): Promise<Request>;
fetch(input: RequestInfo, init?: (RequestInit & {

See TypeScripts signature here: https://github.com/microsoft/TypeScript/blob/main/lib/lib.dom.d.ts#L16971

Note the inclusion of the | URL in the input parameter types.

This is causing errors when using code/types that include things like:

type FetchParameters = Parameters<typeof fetch>
...
const [url, init]: FetchParams = ...
const signed = aws.sign(url, { ...init, ...}) // Type error about incompatible types with `URL`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant