UNPKG

715 BTypeScriptView Raw
1declare module 'timers/promises' {
2 import { TimerOptions } from 'timers';
3
4 /**
5 * Returns a promise that resolves after the specified delay in milliseconds.
6 * @param delay defaults to 1
7 */
8 function setTimeout<T = void>(delay?: number, value?: T, options?: TimerOptions): Promise<T>;
9
10 /**
11 * Returns a promise that resolves in the next tick.
12 */
13 function setImmediate<T = void>(value?: T, options?: TimerOptions): Promise<T>;
14
15 /**
16 *
17 * Returns an async iterator that generates values in an interval of delay ms.
18 * @param delay defaults to 1
19 */
20 function setInterval<T = void>(delay?: number, value?: T, options?: TimerOptions): AsyncIterable<T>;
21}