typestar

Typed sleep in TypeScript

A typed delay, the building block for everything else async here.

function sleep(ms: number): Promise<void> {
  return new Promise((resolve) => {
    setTimeout(resolve, ms);
  });
}

Keywords and builtins used here

The run, in numbers

Lines
5
Characters to type
108
Tokens
33
Three-star pace
105 tpm

At the three-star pace of 105 tokens a minute, this run takes about 19 seconds.

Type this snippet

Step 4 of 5 in Timing & memory, step 17 of 19 in Classes & patterns.

← Previous Next →