From 91d30b4da04d1b822863a09e9eaee64d2ce4db8e Mon Sep 17 00:00:00 2001 From: Alistair Smith Date: Mon, 8 Sep 2025 14:11:00 -0700 Subject: [PATCH] update bun-types from main --- packages/bun-types/globals.d.ts | 24 +++++++++++++++++++++ test/integration/bun-types/fixture/index.ts | 6 ++++++ 2 files changed, 30 insertions(+) diff --git a/packages/bun-types/globals.d.ts b/packages/bun-types/globals.d.ts index ab3685cfff..56fb8515d9 100644 --- a/packages/bun-types/globals.d.ts +++ b/packages/bun-types/globals.d.ts @@ -1564,6 +1564,12 @@ declare var AbortController: Bun.__internal.UseLibDomIfAvailable< } >; +interface AbortSignal extends EventTarget { + readonly aborted: boolean; + onabort: ((this: AbortSignal, ev: Event) => any) | null; + readonly reason: any; + throwIfAborted(): void; +} declare var AbortSignal: Bun.__internal.UseLibDomIfAvailable< "AbortSignal", { @@ -1948,3 +1954,21 @@ declare namespace fetch { ): void; } //#endregion + +interface RegExpConstructor { + /** + * Escapes any potential regex syntax characters in a string, and returns a + * new string that can be safely used as a literal pattern for the RegExp() + * constructor. + * + * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/escape) + * + * @example + * ```ts + * const re = new RegExp(RegExp.escape("foo.bar")); + * re.test("foo.bar"); // true + * re.test("foo!bar"); // false + * ``` + */ + escape(string: string): string; +} diff --git a/test/integration/bun-types/fixture/index.ts b/test/integration/bun-types/fixture/index.ts index a178c91a4b..c459e92ec1 100644 --- a/test/integration/bun-types/fixture/index.ts +++ b/test/integration/bun-types/fixture/index.ts @@ -455,3 +455,9 @@ Bun.serve({ cert, }, }); + +const signal = AbortSignal.timeout(1000); +expectType(signal).is(); +expectType(signal.aborted).is(); + +expectType(RegExp.escape("foo.bar")).is();