禁止顶层 await
禁止使用顶层 await 表达式。
通过 dnt 分发 CommonJS/UMD 时,无法使用顶层 await。
无效示例
await foo();
for await (item of items) {}
有效示例
async function foo() {
await task();
}
async function foo() {
for await (item of items) {}
}
禁止使用顶层 await 表达式。
通过 dnt 分发 CommonJS/UMD 时,无法使用顶层 await。
无效示例
await foo();
for await (item of items) {}
有效示例
async function foo() {
await task();
}
async function foo() {
for await (item of items) {}
}