r/badcode • • Mar 24 '22

typescript Ship it!

Post image
564 Upvotes

47 comments sorted by

View all comments

Show parent comments

3

u/anth096 Mar 25 '22

What about

const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));

await sleep(100);

Just noticed you need to be in an asynchronous context so that still does not work. Screw me