From e7cd45d0fa3f381238ea2ebfbba2d9e738376fcc Mon Sep 17 00:00:00 2001 From: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> Date: Thu, 16 Feb 2023 03:18:01 -0800 Subject: [PATCH] Update globals.d.ts --- packages/bun-types/globals.d.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/packages/bun-types/globals.d.ts b/packages/bun-types/globals.d.ts index a4ddd8c41e..8848f59e64 100644 --- a/packages/bun-types/globals.d.ts +++ b/packages/bun-types/globals.d.ts @@ -1955,6 +1955,21 @@ interface AbortSignal extends EventTarget { options?: boolean | EventListenerOptions, ): void; + /** + * Create an AbortSignal which times out after milliseconds + * + * @param milliseconds the number of milliseconds to delay until {@link AbortSignal.prototype.signal()} is called + * + * @example + * + * ## Timeout a `fetch()` request + * + * ```ts + * await fetch("https://example.com", { + * signal: AbortSignal.timeout(100) + * }) + * ``` + */ timeout(milliseconds: number): AbortSignal; }