/**
 * Promise timeout utility
 *
 * Provides a mechanism to wrap promises with timeout behavior
 * to prevent indefinite hangs during health checks.
 */
/**
 * Wraps a promise with a timeout, rejecting if the operation
 * takes longer than the specified duration.
 *
 * @param promise - The promise to wrap with timeout
 * @param timeoutMs - Timeout duration in milliseconds
 * @param errorMessage - Custom error message for timeout
 * @returns The result of the promise if it resolves before timeout
 * @throws Error if the operation times out
 */
export declare function withTimeout<T>(promise: Promise<T>, timeoutMs: number, errorMessage?: string): Promise<T>;
/**
 * TimeoutError class for type checking timeout errors
 */
export declare class TimeoutError extends Error {
    readonly timeoutMs: number;
    constructor(message: string, timeoutMs: number);
}
/**
 * Wraps a promise with a timeout, returning a TimeoutError instance
 * for easier type checking.
 *
 * @param promise - The promise to wrap with timeout
 * @param timeoutMs - Timeout duration in milliseconds
 * @param errorMessage - Custom error message for timeout
 * @returns The result of the promise if it resolves before timeout
 * @throws TimeoutError if the operation times out
 */
export declare function withTimeoutTyped<T>(promise: Promise<T>, timeoutMs: number, errorMessage?: string): Promise<T>;
/**
 * Check if an error is a timeout error
 */
export declare function isTimeoutError(error: unknown): error is TimeoutError;
//# sourceMappingURL=timeout.d.ts.map