Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experimental support for ES7 async/await #8

Closed
aaronshaf opened this issue Nov 18, 2014 · 19 comments
Closed

Experimental support for ES7 async/await #8

aaronshaf opened this issue Nov 18, 2014 · 19 comments

Comments

@aaronshaf
Copy link

I have fallen in love with 6to5 and traceur's support for async/await. I would love to be able to use this with flow.

@gabelevi
Copy link
Contributor

I'd love this too. I remember @benjamn built a recast transform for async await. Everyone I know who uses jstransform (ourself included) would love to switch to recast ASAP, so when we do it's nice to know there's a transform waiting.

Typing async/await wasn't too hard to do for Hack, so it shouldn't be too hard to do in Flow too, once there is demand for it!

@sophiebits
Copy link
Contributor

async/await is supported in regenerator proper right now; I think that es7-async-await package is old.

@benjamn
Copy link

benjamn commented Nov 18, 2014

That's right, I've stopped working on https://github.com/benjamn/es7-async-await in favor of handling async functions in Regenerator, because only Regenerator can take advantage of the optimization of creating a generator object directly, skipping the creation of the GeneratorFunction.

@benjamn
Copy link

benjamn commented Nov 18, 2014

I should also mention that 6to5 uses Regenerator for its async/await support!

@amasad
Copy link
Contributor

amasad commented Jan 16, 2015

+1

@benjamn
Copy link

benjamn commented Jan 16, 2015

It would be particularly awesome if Flow could somehow warn when exceptions might be swallowed by Promises!

@yornaath
Copy link

Yes async await would be a very nice addition! Any updates on progress? :) 👍

@junosuarez
Copy link

it shouldn't be too hard to do in Flow too, once there is demand for it!

+1 demand :)

@tsing
Copy link

tsing commented May 7, 2015

+1 love this too.

@vjpr
Copy link

vjpr commented May 18, 2015

+1

I get Unexpected token function on my async keywords.

Is there anyway to workaround this?

@jtremback
Copy link

👍

@bhosmer
Copy link
Contributor

bhosmer commented Jun 16, 2015

Async/await support added in v0.12.

@bhosmer bhosmer closed this as completed Jun 16, 2015
jeffmo pushed a commit to jeffmo/flow that referenced this issue Jul 31, 2015
Ensure lexer expects XJS child after nested close
@johngeorgewright
Copy link

I'm still getting errors for the await* syntax.

@samwgoldman
Copy link
Member

@johngeorgewright can you give an example?

@johngeorgewright
Copy link

/* @flow */

function somethingParallel() {}
function somethingElseParallel() {}

async function somethingAsynchronous() {
  await* [
    somethingParallel(),
    somethingElseParallel()
  ];
}
 $  flow

.../test.js:7:8,8: Unexpected token *

Found 1 error

@johngeorgewright
Copy link

$  flow --version
Flow, a static type checker for JavaScript, version 0.14.0

@samwgoldman
Copy link
Member

@johngeorgewright Thanks. The closest thing I could find as far as documentation is this section of the proposal, but I'm not sure if that is being tracked along side async/await in the ES process.

I will note that Babel seems to understand this syntax, so it could very well be an omission here. @sebmck, sorry to drag you into this, but do you know what's up with this feature? Is it a part of the "standard" async/await feature, or is it on a separate schedule/phase?

@sebmck
Copy link
Contributor

sebmck commented Aug 10, 2015

No worries at all. await* is from an early proposal. You can see a reference here. It's most likely going to be removed in Babel 6.0 as it's not on standards track.

@johngeorgewright
Copy link

Ah, OK, sorry. So I'm to use await Promise.all()... I hadn't realised that. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests