Skip to content

[Feature Request] Missing overloads for append and set #1

@lnfel

Description

@lnfel

Native FormData implementation has overload for accepting Blob with filename for append and set:

append(name: string, value: unknown, fileName?: string): void
set(name: string, value: unknown, fileName?: string): void

These types are from undici.

I did saw typed-formdata implementation has the fieldname argument covered by both methods, it's just types are not reflecting the implementation.

We can add these overloads:

append(key: string, value: Blob, fileName?: string): void;
set(key: string, value: Blob, fileName?: string): void;

For now I intersect the missing overloads using module augmentation:

declare module "@k1eu/typed-formdata" {
    interface TypedFormData<T extends Record<string, string | File>> {
        append(key: string, value: Blob, fileName?: string): void;
        set(key: string, value: Blob, fileName?: string): void;
    }
}

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