Function treated as "unexpected token" when trying to use async

Hey guys!

As always, super thankful for all the work you put into these tools, they’re amazing.

I’m just trying to wrap my head around async/await, which I wanted to try out in a project I’m working on.

The code is simply this:

async function fetchInvoiceData(postID) {

  let promise = new Promise((resolve) => {
    setTimeout(() => resolve("done!"), 1000)

  let result = await promise; // wait till the promise resolves (*)

  alert(result); // "done!"

Upon googling it seems like it might be a config issue, but I’m not entirely sure where to start digging. Anyone that could give me a heads up?

Hey @intelligence - I don’t think Buble, which Sage uses for transpiling JS, supports async/await, unfortunately. You may be able to find a way to work around that–if you do, please share your solution!


This topic was automatically closed after 42 days. New replies are no longer allowed.