aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Ryan Bargholz <rbargholz@gmail.com> 2022-07-12 17:47:58 +0900
committerGravatar GitHub <noreply@github.com> 2022-07-12 01:47:58 -0700
commit734775e4100fce92961a6f8dd6a8fd0ea45a68eb (patch)
tree0e9bca46abb8e4d2d712ae6f22c8658d3b0cdaf9
parent4987067a182d0b6988be79f4f3f63360fb44cc2d (diff)
downloadbun-734775e4100fce92961a6f8dd6a8fd0ea45a68eb.tar.gz
bun-734775e4100fce92961a6f8dd6a8fd0ea45a68eb.tar.zst
bun-734775e4100fce92961a6f8dd6a8fd0ea45a68eb.zip
Support specifying a JSON response type in bun.d.ts (#563)
Co-authored-by: Ryan Bargholz <ryan@asteria.com>
-rw-r--r--types/bun/globals.d.ts8
1 files changed, 4 insertions, 4 deletions
diff --git a/types/bun/globals.d.ts b/types/bun/globals.d.ts
index 194cef2be..aad02d70f 100644
--- a/types/bun/globals.d.ts
+++ b/types/bun/globals.d.ts
@@ -216,7 +216,7 @@ declare module "node:process" {
interface BlobInterface {
text(): Promise<string>;
arrayBuffer(): Promise<ArrayBuffer>;
- json(): Promise<JSON>;
+ json<TJSONReturnType = unknown>(): Promise<TJSONReturnType>;
}
type BlobPart = string | Blob | ArrayBufferView | ArrayBuffer;
@@ -311,7 +311,7 @@ declare class Blob implements BlobInterface {
* This first decodes the data from UTF-8, then parses it as JSON.
*
*/
- json(): Promise<JSON>;
+ json<TJSONReturnType = unknown>(): Promise<TJSONReturnType>;
type: string;
size: number;
@@ -430,7 +430,7 @@ declare class Response implements BlobInterface {
* This first decodes the data from UTF-8, then parses it as JSON.
*
*/
- json(): Promise<JSON>;
+ json<TJSONReturnType = unknown>(): Promise<TJSONReturnType>;
/**
* Read the data from the Response as a Blob.
@@ -637,7 +637,7 @@ declare class Request implements BlobInterface {
* This first decodes the data from UTF-8, then parses it as JSON.
*
*/
- json(): Promise<JSON>;
+ json<TJSONReturnType = unknown>(): Promise<TJSONReturnType>;
/**
* Consume the [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request) body as a `Blob`.