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;
}
}
Native FormData implementation has overload for accepting Blob with filename for
appendandset:These types are from undici.
I did saw
typed-formdataimplementation has thefieldnameargument covered by both methods, it's just types are not reflecting the implementation.We can add these overloads:
For now I intersect the missing overloads using module augmentation: