Skip to content

Commit

Permalink
stricter types for bodymixin.json (nodejs#2181)
Browse files Browse the repository at this point in the history
  • Loading branch information
KhafraDev authored and crysmags committed Feb 27, 2024
1 parent faa3d89 commit e02e6fb
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion test/types/dispatcher.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,5 +119,5 @@ declare const { body }: Dispatcher.ResponseData;
expectType<Promise<Blob>>(body.blob())
expectType<Promise<never>>(body.formData())
expectType<Promise<string>>(body.text())
expectType<Promise<any>>(body.json())
expectType<Promise<unknown>>(body.json())
}
2 changes: 1 addition & 1 deletion test/types/readable.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ expectAssignable<BodyReadable>(new BodyReadable())
expectAssignable<Promise<string>>(readable.text())

// json
expectAssignable<Promise<any>>(readable.json())
expectAssignable<Promise<unknown>>(readable.json())

// blob
expectAssignable<Promise<Blob>>(readable.blob())
Expand Down
2 changes: 1 addition & 1 deletion types/dispatcher.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ declare namespace Dispatcher {
arrayBuffer(): Promise<ArrayBuffer>;
blob(): Promise<Blob>;
formData(): Promise<never>;
json(): Promise<any>;
json(): Promise<unknown>;
text(): Promise<string>;
}

Expand Down
2 changes: 1 addition & 1 deletion types/readable.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ declare class BodyReadable extends Readable {
/** Consumes and returns the body as a JavaScript Object
* https://fetch.spec.whatwg.org/#dom-body-json
*/
json(): Promise<any>
json(): Promise<unknown>

/** Consumes and returns the body as a Blob
* https://fetch.spec.whatwg.org/#dom-body-blob
Expand Down

0 comments on commit e02e6fb

Please sign in to comment.