bun-types 1.0.21 → 1.0.23

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/types.d.ts +55 -16
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bun-types",
3
- "version": "1.0.21",
3
+ "version": "1.0.23",
4
4
  "license": "MIT",
5
5
  "description": "Type definitions for Bun, an incredibly fast JavaScript runtime",
6
6
  "types": "types.d.ts",
package/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Type definitions for bun 1.0.21
1
+ // Type definitions for bun 1.0.23
2
2
  // Project: https://github.com/oven-sh/bun
3
3
  // Definitions by: Jarred Sumner <https://github.com/Jarred-Sumner>
4
4
  // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -597,6 +597,12 @@ interface ImportMeta {
597
597
  * ```
598
598
  */
599
599
  readonly main: boolean;
600
+
601
+ /** Alias of `import.meta.dir`. Exists for Node.js compatibility */
602
+ readonly dirname: string;
603
+
604
+ /** Alias of `import.meta.path`. Exists for Node.js compatibility */
605
+ readonly filename: string;
600
606
  }
601
607
 
602
608
  /**
@@ -707,7 +713,7 @@ declare namespace Bun {
707
713
  * but the values will be available on the global `Bun.argv` as if they
708
714
  * were passed as CLI options to the script.
709
715
  */
710
- // argv?: any[] | undefined;
716
+ argv?: any[] | undefined;
711
717
 
712
718
  /** If `true` and the first argument is a string, interpret the first argument to the constructor as a script that is executed once the worker is online. */
713
719
  // eval?: boolean | undefined;
@@ -717,7 +723,7 @@ declare namespace Bun {
717
723
  */
718
724
  env?:
719
725
  | Record<string, string>
720
- | typeof import("node:worker_threads")["SHARE_ENV"]
726
+ | (typeof import("node:worker_threads"))["SHARE_ENV"]
721
727
  | undefined;
722
728
 
723
729
  /**
@@ -3555,8 +3561,8 @@ declare module "bun:ffi" {
3555
3561
  type ToFFIType<T extends FFITypeOrString> = T extends FFIType
3556
3562
  ? T
3557
3563
  : T extends string
3558
- ? FFITypeStringToType[T]
3559
- : never;
3564
+ ? FFITypeStringToType[T]
3565
+ : never;
3560
3566
 
3561
3567
  // eslint-disable-next-line @definitelytyped/no-single-element-tuple-type
3562
3568
  type _Narrow<T, U> = [U] extends [T] ? U : Extract<T, U>;
@@ -3576,9 +3582,9 @@ declare module "bun:ffi" {
3576
3582
  ...args: Fns[K]["args"] extends infer A extends readonly FFITypeOrString[]
3577
3583
  ? { [L in keyof A]: FFITypeToArgsType[ToFFIType<A[L]>] }
3578
3584
  : // eslint-disable-next-line @definitelytyped/no-single-element-tuple-type
3579
- [unknown] extends [Fns[K]["args"]]
3580
- ? []
3581
- : never
3585
+ [unknown] extends [Fns[K]["args"]]
3586
+ ? []
3587
+ : never
3582
3588
  ) => // eslint-disable-next-line @definitelytyped/no-single-element-tuple-type
3583
3589
  [unknown] extends [Fns[K]["returns"]]
3584
3590
  ? undefined
@@ -8877,8 +8883,8 @@ declare module "bun" {
8877
8883
  type ReadableToIO<X extends Readable> = X extends "pipe" | undefined
8878
8884
  ? ReadableStream<Uint8Array>
8879
8885
  : X extends BunFile | ArrayBufferView | number
8880
- ? number
8881
- : undefined;
8886
+ ? number
8887
+ : undefined;
8882
8888
 
8883
8889
  type ReadableToSyncIO<X extends Readable> = X extends "pipe" | undefined
8884
8890
  ? Buffer
@@ -8889,8 +8895,8 @@ declare module "bun" {
8889
8895
  type WritableToIO<X extends Writable> = X extends "pipe"
8890
8896
  ? FileSink
8891
8897
  : X extends BunFile | ArrayBufferView | Blob | Request | Response | number
8892
- ? number
8893
- : undefined;
8898
+ ? number
8899
+ : undefined;
8894
8900
  }
8895
8901
 
8896
8902
  interface ResourceUsage {
@@ -10704,6 +10710,31 @@ declare module "bun:test" {
10704
10710
  * @param expected the expected value
10705
10711
  */
10706
10712
  toContainKey(expected: unknown): void;
10713
+ /**
10714
+ * Asserts that an `object` contains at least one of the provided keys.
10715
+ * Asserts that an `object` contains all the provided keys.
10716
+ *
10717
+ * The value must be an object
10718
+ *
10719
+ * @example
10720
+ * expect({ a: 'hello', b: 'world' }).toContainAnyKeys(['a']);
10721
+ * expect({ a: 'hello', b: 'world' }).toContainAnyKeys(['b']);
10722
+ * expect({ a: 'hello', b: 'world' }).toContainAnyKeys(['b', 'c']);
10723
+ * expect({ a: 'hello', b: 'world' }).not.toContainAnyKeys(['c']);
10724
+ *
10725
+ * @param expected the expected value
10726
+ */
10727
+ toContainAnyKeys(expected: unknown): void;
10728
+
10729
+ /**
10730
+ * Asserts that an `object` contains all the provided keys.
10731
+ * expect({ a: 'foo', b: 'bar', c: 'baz' }).toContainKeys(['a', 'b']);
10732
+ * expect({ a: 'foo', b: 'bar', c: 'baz' }).toContainKeys(['a', 'b', 'c']);
10733
+ * expect({ a: 'foo', b: 'bar', c: 'baz' }).not.toContainKeys(['a', 'b', 'e']);
10734
+ *
10735
+ * @param expected the expected value
10736
+ */
10737
+ toContainKeys(expected: unknown): void;
10707
10738
  /**
10708
10739
  * Asserts that a value contains and equals what is expected.
10709
10740
  *
@@ -10934,6 +10965,14 @@ declare module "bun:test" {
10934
10965
  * expect(new Set()).toBeEmpty();
10935
10966
  */
10936
10967
  toBeEmpty(): void;
10968
+ /**
10969
+ * Asserts that a value is an empty `object`.
10970
+ *
10971
+ * @example
10972
+ * expect({}).toBeEmptyObject();
10973
+ * expect({ a: 'hello' }).not.toBeEmptyObject();
10974
+ */
10975
+ toBeEmptyObject(): void;
10937
10976
  /**
10938
10977
  * Asserts that a value is `null` or `undefined`.
10939
10978
  *
@@ -11639,8 +11678,8 @@ declare namespace JestMock {
11639
11678
  export type Spied<T extends ClassLike | FunctionLike> = T extends ClassLike
11640
11679
  ? SpiedClass<T>
11641
11680
  : T extends FunctionLike
11642
- ? SpiedFunction<T>
11643
- : never;
11681
+ ? SpiedFunction<T>
11682
+ : never;
11644
11683
 
11645
11684
  export type SpiedClass<T extends ClassLike = UnknownClass> = MockInstance<
11646
11685
  (...args: ConstructorParameters<T>) => InstanceType<T>
@@ -11681,8 +11720,8 @@ declare namespace JestMock {
11681
11720
  ): A extends "get"
11682
11721
  ? SpiedGetter<V>
11683
11722
  : A extends "set"
11684
- ? SpiedSetter<V>
11685
- : never;
11723
+ ? SpiedSetter<V>
11724
+ : never;
11686
11725
  <
11687
11726
  T_1 extends object,
11688
11727
  K_5 extends