Skip to content

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

@adworacz

Description

@adworacz

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`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions