diff options
Diffstat (limited to '')
-rw-r--r-- | packages/bun-types/globals.d.ts | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/packages/bun-types/globals.d.ts b/packages/bun-types/globals.d.ts index a4ddd8c41..8848f59e6 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; } |