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/test.d.ts CHANGED
@@ -390,11 +390,20 @@ declare module "bun:test" {
390
390
  */
391
391
  repeats?: number;
392
392
  }
393
- type IsTuple<T> = T extends readonly unknown[]
394
- ? number extends T["length"]
395
- ? false // It's an array with unknown length, not a tuple
396
- : true // It's an array with a fixed length (a tuple)
397
- : false; // Not an array at all
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 Readonly<any[]>> {
430
+ export interface Test<T extends ReadonlyArray<unknown>> {
422
431
  (
423
432
  label: string,
424
- fn: (...args: IsTuple<T> extends true ? [...T, (err?: unknown) => void] : T) => void | Promise<unknown>,
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<[any, ...any[]]>>(table: readonly T[]): Test<[...T]>;
517
- each<T extends any[]>(table: readonly T[]): Test<[...T]>;
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
  /**