bun-types 1.3.3-canary.20251119T140729 → 1.3.3-canary.20251121T140620

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -245,7 +245,7 @@ The table below lists all globals implemented by Node.js and Bun's current compa
245
245
 
246
246
  ### [`CompressionStream`](https://developer.mozilla.org/en-US/docs/Web/API/CompressionStream)
247
247
 
248
- 🔴 Not implemented.
248
+ 🟢 Fully implemented.
249
249
 
250
250
  ### [`console`](https://developer.mozilla.org/en-US/docs/Web/API/console)
251
251
 
@@ -273,7 +273,7 @@ The table below lists all globals implemented by Node.js and Bun's current compa
273
273
 
274
274
  ### [`DecompressionStream`](https://developer.mozilla.org/en-US/docs/Web/API/DecompressionStream)
275
275
 
276
- 🔴 Not implemented.
276
+ 🟢 Fully implemented.
277
277
 
278
278
  ### [`Event`](https://developer.mozilla.org/en-US/docs/Web/API/Event)
279
279
 
package/overrides.d.ts CHANGED
@@ -23,16 +23,6 @@ interface BunConsumerConvenienceMethods {
23
23
  * Consume as JSON
24
24
  */
25
25
  json(): Promise<any>;
26
-
27
- /**
28
- * Consume as a FormData instance
29
- */
30
- formData(): Promise<FormData>;
31
-
32
- /**
33
- * Consume as an ArrayBuffer
34
- */
35
- arrayBuffer(): Promise<ArrayBuffer>;
36
26
  }
37
27
 
38
28
  declare module "stream/web" {
@@ -51,6 +41,21 @@ declare module "buffer" {
51
41
  // slightly different from just "copying in the methods" (the difference is
52
42
  // related to how type parameters are resolved)
53
43
  bytes(): Promise<Uint8Array<ArrayBuffer>>;
44
+
45
+ /**
46
+ * Consume the blob as a FormData instance
47
+ */
48
+ formData(): Promise<FormData>;
49
+
50
+ /**
51
+ * Consume the blob as an ArrayBuffer
52
+ */
53
+ arrayBuffer(): Promise<ArrayBuffer>;
54
+
55
+ /**
56
+ * Returns a readable stream of the blob's contents
57
+ */
58
+ stream(): ReadableStream<Uint8Array<ArrayBuffer>>;
54
59
  }
55
60
  }
56
61
 
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.3.3-canary.20251119T140729",
2
+ "version": "1.3.3-canary.20251121T140620",
3
3
  "name": "bun-types",
4
4
  "license": "MIT",
5
5
  "types": "./index.d.ts",
package/serve.d.ts CHANGED
@@ -283,7 +283,8 @@ declare module "bun" {
283
283
  * return new Response();
284
284
  * },
285
285
  * websocket: {
286
- * open(ws) {
286
+ * data: {} as {accessToken: string | null},
287
+ * message(ws) {
287
288
  * console.log(ws.data.accessToken);
288
289
  * }
289
290
  * }
@@ -486,13 +487,15 @@ declare module "bun" {
486
487
  }
487
488
 
488
489
  namespace Serve {
489
- type ExtractRouteParams<T> = T extends `${string}:${infer Param}/${infer Rest}`
490
- ? { [K in Param]: string } & ExtractRouteParams<Rest>
491
- : T extends `${string}:${infer Param}`
492
- ? { [K in Param]: string }
493
- : T extends `${string}*`
494
- ? {}
495
- : {};
490
+ type ExtractRouteParams<T> = string extends T
491
+ ? Record<string, string>
492
+ : T extends `${string}:${infer Param}/${infer Rest}`
493
+ ? { [K in Param]: string } & ExtractRouteParams<Rest>
494
+ : T extends `${string}:${infer Param}`
495
+ ? { [K in Param]: string }
496
+ : T extends `${string}*`
497
+ ? {}
498
+ : {};
496
499
 
497
500
  /**
498
501
  * Development configuration for {@link Bun.serve}
@@ -549,14 +552,16 @@ declare module "bun" {
549
552
  [Path in R]:
550
553
  | BaseRouteValue
551
554
  | Handler<BunRequest<Path>, Server<WebSocketData>, Response>
552
- | Partial<Record<HTTPMethod, Handler<BunRequest<Path>, Server<WebSocketData>, Response>>>;
555
+ | Partial<Record<HTTPMethod, Handler<BunRequest<Path>, Server<WebSocketData>, Response> | Response>>;
553
556
  };
554
557
 
555
558
  type RoutesWithUpgrade<WebSocketData, R extends string> = {
556
559
  [Path in R]:
557
560
  | BaseRouteValue
558
561
  | Handler<BunRequest<Path>, Server<WebSocketData>, Response | undefined | void>
559
- | Partial<Record<HTTPMethod, Handler<BunRequest<Path>, Server<WebSocketData>, Response | undefined | void>>>;
562
+ | Partial<
563
+ Record<HTTPMethod, Handler<BunRequest<Path>, Server<WebSocketData>, Response | undefined | void> | Response>
564
+ >;
560
565
  };
561
566
 
562
567
  type FetchOrRoutes<WebSocketData, R extends string> =
@@ -786,7 +791,7 @@ declare module "bun" {
786
791
  * } satisfies Bun.Serve.Options<{ name: string }>;
787
792
  * ```
788
793
  */
789
- type Options<WebSocketData, R extends string = never> = Bun.__internal.XOR<
794
+ type Options<WebSocketData, R extends string = string> = Bun.__internal.XOR<
790
795
  HostnamePortServeOptions<WebSocketData>,
791
796
  UnixServeOptions<WebSocketData>
792
797
  > &
@@ -1276,7 +1281,7 @@ declare module "bun" {
1276
1281
  * });
1277
1282
  * ```
1278
1283
  */
1279
- function serve<WebSocketData = undefined, R extends string = string>(
1284
+ function serve<WebSocketData = undefined, R extends string = never>(
1280
1285
  options: Serve.Options<WebSocketData, R>,
1281
1286
  ): Server<WebSocketData>;
1282
1287
  }