MultiLoader-Template/node_modules/es-toolkit/dist/promise/timeout.d.ts
3944Realms 768f38fc97 feat: 可使用的构建模板
修改了脚本,使其可以推给Maven仓库
2026-05-03 13:02:19 +08:00

18 lines
586 B
TypeScript

/**
* Returns a promise that rejects with a `TimeoutError` after a specified delay.
*
* @param {number} ms - The delay duration in milliseconds.
* @returns {Promise<never>} A promise that rejects with a `TimeoutError` after the specified delay.
* @throws {TimeoutError} Throws a `TimeoutError` after the specified delay.
*
* @example
* try {
* await timeout(1000); // Timeout exception after 1 second
* } catch (error) {
* console.error(error); // Will log 'The operation was timed out'
* }
*/
declare function timeout(ms: number): Promise<never>;
export { timeout };