diff --git a/types/superagent/index.d.ts b/types/superagent/index.d.ts index 9c3706d574..e02747ac5d 100644 --- a/types/superagent/index.d.ts +++ b/types/superagent/index.d.ts @@ -94,7 +94,7 @@ declare namespace request { interface Request extends Promise /* extends NodeJS.WritableStream */ { abort(): void; accept(type: string): this; - attach(field: string, file: string, filename?: string): this; + attach(field: string, file: string | Blob, filename?: string): this; auth(user: string, name: string): this; buffer(val?: boolean): this; clearTimeout(): this; diff --git a/types/superagent/superagent-tests.ts b/types/superagent/superagent-tests.ts index 9d0e5f0ac9..9e8dc0aa96 100644 --- a/types/superagent/superagent-tests.ts +++ b/types/superagent/superagent-tests.ts @@ -262,11 +262,13 @@ stream.pipe(req); })(); // Attaching files +const blob: Blob = new File([], 'thor.png'); request .post('/upload') .attach('avatar', 'path/to/tobi.png', 'user.png') .attach('image', 'path/to/loki.png') .attach('file', 'path/to/jane.png') + .attach('blob', blob) .end(callback); // Field values