Appearance
为 Promise 添加超时控制。
import { withTimeout } from '@base-web-kits/base-tools-ts'; await withTimeout(fetch('https://example.com'), 5000); // 如果 5秒内未完成,抛出 TimeoutError
promise (Promise)
ms (number)
(Promise<any>)