mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-18 15:33:12 +09:00
Use return type deduction for timers
Fix updates to Node.js timers types breaking the TypeScript build by deducing the correct type from the return type of the setTimeout/setInterval functions.
This commit is contained in:
1 parent
e51a644788
commit
9c9adf7c8e
6 files changed
+8
-8
No files matched your search
@@ -37,7 +37,7 @@ export async function wait(duration: number) {
|
||||
* @param {*=} timeoutResult - Value to return if the operation timed out.
|
||||
*/
|
||||
export async function timeout<T>(promise: Promise<T>, time: number, timeoutResult: T) {
|
||||
let timer: NodeJS.Timer | undefined;
|
||||
let timer: ReturnType<typeof setTimeout> | undefined;
|
||||
try {
|
||||
return await Promise.race([
|
||||
promise,
|
||||
|
||||
Reference in new issue
Block a user