bun-types 1.2.24-canary.20251006T140715 → 1.2.24-canary.20251008T140733
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.
- package/bun.d.ts +65 -1514
- package/bun.ns.d.ts +0 -2
- package/deprecated.d.ts +5 -0
- package/docs/api/fetch.md +1 -1
- package/docs/api/spawn.md +1 -1
- package/docs/api/websockets.md +9 -3
- package/docs/cli/pm.md +1 -1
- package/docs/cli/publish.md +1 -1
- package/docs/guides/ecosystem/nuxt.md +1 -1
- package/docs/guides/install/add-peer.md +2 -2
- package/docs/guides/install/from-npm-install-to-bun-install.md +1 -1
- package/docs/guides/test/run-tests.md +3 -3
- package/docs/guides/test/snapshot.md +3 -3
- package/docs/guides/test/update-snapshots.md +1 -1
- package/docs/guides/util/version.md +1 -1
- package/docs/guides/websocket/context.md +8 -3
- package/docs/guides/websocket/pubsub.md +4 -1
- package/docs/guides/websocket/simple.md +1 -1
- package/docs/installation.md +4 -4
- package/docs/project/contributing.md +1 -1
- package/docs/runtime/bunfig.md +40 -0
- package/docs/runtime/debugger.md +3 -3
- package/docs/test/dom.md +1 -1
- package/globals.d.ts +64 -12
- package/index.d.ts +1 -0
- package/package.json +1 -1
- package/serve.d.ts +1272 -0
- package/test.d.ts +24 -9
package/test.d.ts
CHANGED
|
@@ -390,11 +390,20 @@ declare module "bun:test" {
|
|
|
390
390
|
*/
|
|
391
391
|
repeats?: number;
|
|
392
392
|
}
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
393
|
+
|
|
394
|
+
namespace __internal {
|
|
395
|
+
type IsTuple<T> = T extends readonly unknown[]
|
|
396
|
+
? number extends T["length"]
|
|
397
|
+
? false // It's an array with unknown length, not a tuple
|
|
398
|
+
: true // It's an array with a fixed length (a tuple)
|
|
399
|
+
: false; // Not an array at all
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* Accepts `[1, 2, 3] | ["a", "b", "c"]` and returns `[1 | "a", 2 | "b", 3 | "c"]`
|
|
403
|
+
*/
|
|
404
|
+
type Flatten<T, Copy extends T = T> = { [Key in keyof T]: Copy[Key] };
|
|
405
|
+
}
|
|
406
|
+
|
|
398
407
|
/**
|
|
399
408
|
* Runs a test.
|
|
400
409
|
*
|
|
@@ -418,10 +427,16 @@ declare module "bun:test" {
|
|
|
418
427
|
*
|
|
419
428
|
* @category Testing
|
|
420
429
|
*/
|
|
421
|
-
export interface Test<T extends
|
|
430
|
+
export interface Test<T extends ReadonlyArray<unknown>> {
|
|
422
431
|
(
|
|
423
432
|
label: string,
|
|
424
|
-
|
|
433
|
+
|
|
434
|
+
fn: (
|
|
435
|
+
...args: __internal.IsTuple<T> extends true
|
|
436
|
+
? [...table: __internal.Flatten<T>, done: (err?: unknown) => void]
|
|
437
|
+
: T
|
|
438
|
+
) => void | Promise<unknown>,
|
|
439
|
+
|
|
425
440
|
/**
|
|
426
441
|
* - If a `number`, sets the timeout for the test in milliseconds.
|
|
427
442
|
* - If an `object`, sets the options for the test.
|
|
@@ -513,8 +528,8 @@ declare module "bun:test" {
|
|
|
513
528
|
*
|
|
514
529
|
* @param table Array of Arrays with the arguments that are passed into the test fn for each row.
|
|
515
530
|
*/
|
|
516
|
-
each<T extends Readonly<[
|
|
517
|
-
each<T extends
|
|
531
|
+
each<T extends Readonly<[unknown, ...unknown[]]>>(table: readonly T[]): Test<T>;
|
|
532
|
+
each<T extends unknown[]>(table: readonly T[]): Test<T>;
|
|
518
533
|
each<T>(table: T[]): Test<[T]>;
|
|
519
534
|
}
|
|
520
535
|
/**
|