/** * Adds a timeout to any promise, rejecting if the timeout is exceeded. * * @param promise - The promise to add timeout to. * @param timeoutMs - Timeout duration in milliseconds. * @param timeoutMessage - Custom error message for timeout (default: 'Operation timed out'). * @returns Promise that resolves with the original promise result or rejects on timeout. * * @throws {Error} If timeoutMs is negative or timeoutMessage is not a string. * @throws {Error} With timeout message if the operation times out. * * @example * // Basic timeout * const result = await asyncTimeout( * fetch('/api/data'), * 5000 * ); // Times out after 5 seconds * * @example * // Custom timeout message * const result = await asyncTimeout( * longRunningOperation(), * 10000, * 'Long operation timed out' * ); * * @example * // Timeout with async function * const result = await asyncTimeout( * (async () => { * await delay(15000); * return 'completed'; * })(), * 10000 * ); // Will throw timeout error * * @note The timeout does not cancel the original promise, it just stops waiting for it. * * @complexity Time: O(1), Space: O(1) */ export declare function asyncTimeout(promise: Promise, timeoutMs: number, timeoutMessage?: string): Promise; //# sourceMappingURL=asyncTimeout.d.ts.map