-
Notifications
You must be signed in to change notification settings - Fork 65
Open
Description
Hello, I ran into the following issue:
- code:
const testarray = [
{id: 1, name: 'foo'},
{id: 2, name: 'bar'}
]
const doarray = [2]
const test = async () => {
for (let i=0; i < doarray.length; i++) {
const a = testarray.findIndex(x => x.id === doarray[i])
await Promise.resolve(console.log(a))
}
}
test()result: Error: Cannot use keyword 'await' outside an async function.
- code:
const testarray = [
{id: 1, name: 'foo'},
{id: 2, name: 'bar'}
]
const doarray = [2]
const test = async () => {
const geta = i => testarray.findIndex(x => x.id === doarray[i])
for (let i=0; i < doarray.length; i++) {
const a = geta(i)
await Promise.resolve(console.log(a))
}
}
test()result: compiles fine.
This was encountered using Rollup 2.21.0 and @rollup/plugin-buble 0.21.3 (Windows 10), with:
transforms: {asyncAwait: false}Metadata
Metadata
Assignees
Labels
No labels