@waboyz-baileys/shared
Version:
10 lines (9 loc) • 427 B
TypeScript
/**
* Wraps an async operation with a timeout.
*
* @param label - A human-readable label for logging.
* @param fn - The async function to execute.
* @param timeout - Timeout in milliseconds. default: 5_000
* @returns The result of the async function, or throws if it times out or fn() rejects.
*/
export declare function withTimeout<T>(label: string, fn: () => Promise<T> | T, timeout?: number): Promise<T | undefined>;