Skip to content

@types/form-data: Property 'getBuffer' does not exist on type 'FormData' #427

@tabeth

Description

@tabeth

The new property on FormData, getBuffer isn't properly typed in TypeScript.

The latest types are the following:

declare class FormData extends stream.Readable {
    append(key: string, value: any, options?: FormData.AppendOptions | string): void;
    getHeaders(): FormData.Headers;
    submit(params: string | FormData.SubmitOptions, callback?: (error: Error | undefined, response: http.IncomingMessage) => void): http.ClientRequest;
    getBoundary(): string;
    getLength(callback: (err: Error | undefined, length: number) => void): void;
    getLengthSync(): number;
    hasKnownLength(): boolean;
}

We need it to look like the following:

declare class FormData extends stream.Readable {
    append(key: string, value: any, options?: FormData.AppendOptions | string): void;
    getHeaders(): FormData.Headers;
    getBuffer(): Buffer;
    submit(params: string | FormData.SubmitOptions, callback?: (error: Error | undefined, response: http.IncomingMessage) => void): http.ClientRequest;
    getBoundary(): string;
    getLength(callback: (err: Error | undefined, length: number) => void): void;
    getLengthSync(): number;
    hasKnownLength(): boolean;
}

If there isn't already a pull request open in DefinitelyTyped I can create one.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions