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
SyntaxError: await is only valid in async function
SyntaxError: await is only valid in async function
at Array.eval (<anonymous>)
[...]
Expression:
function test_await() {
response = await fetch('./api');
json = await response.json();
console.log(json);
}
The text was updated successfully, but these errors were encountered:
I haven't figured out a way to use js2-mode's API to check whether current function is async or not, or any other approach that could potentially work. It seems like code related to that is used while parsing, and can't be easily used to check whether point is at an async function. It's also worth noting that there's no node type for async token or anything like that. It might be worth asking the developer of js2-mode whether there's any way to do this for code using this mode's code.
Evaluating the following:
...gives:
The text was updated successfully, but these errors were encountered: