Skip to main content

no-top-level-await

Disallows the use of top level await expressions.

Top level await cannot be used when distributing CommonJS/UMD via dnt.

Invalid:

await foo();
for await (item of items) {}

Valid:

async function foo() {
  await task();
}
async function foo() {
  for await (item of items) {}
}

Did you find what you needed?

Privacy policy