Skip to content

Commit 8b1c093

Browse files
authored
node.js fetch is wrongly typed bpasero#1 (#4272)
1 parent be11b7d commit 8b1c093

2 files changed

Lines changed: 2 additions & 0 deletions

File tree

test/types/fetch.test-d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ expectType<boolean>(response.bodyUsed)
174174
expectType<Promise<ArrayBuffer>>(response.arrayBuffer())
175175
expectType<Promise<Blob>>(response.blob())
176176
expectType<Promise<FormData>>(response.formData())
177+
expectType<Promise<Uint8Array>>(response.bytes())
177178
expectType<Promise<unknown>>(response.json())
178179
expectType<Promise<string>>(response.text())
179180
expectType<Response>(response.clone())

types/fetch.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export class BodyMixin {
3333

3434
readonly arrayBuffer: () => Promise<ArrayBuffer>
3535
readonly blob: () => Promise<Blob>
36+
readonly bytes: () => Promise<Uint8Array>
3637
/**
3738
* @deprecated This method is not recommended for parsing multipart/form-data bodies in server environments.
3839
* It is recommended to use a library such as [@fastify/busboy](https://www.npmjs.com/package/@fastify/busboy) as follows:

0 commit comments

Comments
 (0)