You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The README says allowAwaitOutsideFunction defaults to true for ecmaVersion >= 2022:
allowAwaitOutsideFunction: If false, await expressions can only appear inside async functions. Defaults to true for ecmaVersion 2022 and later, false for lower versions. Setting this option to true allows to have top-level await expressions. They are still not allowed in non-async functions, though.
However the following code fails with SyntaxError: Unexpected token (2:16)?
import*asacornfrom'acorn';constcode=`const x = await foo();`;try{acorn.parse(code,{ecmaVersion: 2022,// allowAwaitOutsideFunction: true});}catch(error){console.error(error);}
Uncommenting allowAwaitOutsideFunction: true resolves the issue though this seems to conflict with what the aforementioned docs are saying.
The text was updated successfully, but these errors were encountered:
The README says
allowAwaitOutsideFunction
defaults to true for ecmaVersion >= 2022:However the following code fails with
SyntaxError: Unexpected token (2:16)
?Uncommenting
allowAwaitOutsideFunction: true
resolves the issue though this seems to conflict with what the aforementioned docs are saying.The text was updated successfully, but these errors were encountered: