Skip to main content
setTimeout - node__timers--promises.d.ts - Node documentation
function setTimeout

Usage in Deno

```typescript import { setTimeout } from "node:node__timers--promises.d.ts"; ```
setTimeout<T = void>(
delay?: number,
value?: T,
options?: TimerOptions,
): Promise<T>
```js import { setTimeout, } from 'node:timers/promises'; const res = await setTimeout(100, 'result'); console.log(res); // Prints 'result' ```

Type Parameters

T = void

Parameters

optional
delay: number = 1
The number of milliseconds to wait before fulfilling the promise.
optional
value: T
A value with which the promise is fulfilled.
optional
options: TimerOptions

Return Type

Promise<T>