summaryrefslogtreecommitdiff
path: root/cli/tests/top_level_for_await.ts
blob: 92d8af30a4f5ceeb1277e7de455a15a38477ec64 (plain)
1
2
3
4
5
6
7
8
9
10
11
// eslint-disable-next-line require-await
async function* asyncGenerator(): AsyncIterableIterator<number> {
  let i = 0;
  while (i < 3) {
    yield i++;
  }
}

for await (const num of asyncGenerator()) {
  console.log(num);
}