GithubHelp home page GithubHelp logo

Comments (19)

gabelevi avatar gabelevi commented on April 23, 2024

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!

from flow.

sophiebits avatar sophiebits commented on April 23, 2024

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

from flow.

benjamn avatar benjamn commented on April 23, 2024

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.

from flow.

benjamn avatar benjamn commented on April 23, 2024

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

from flow.

amasad avatar amasad commented on April 23, 2024

+1

from flow.

benjamn avatar benjamn commented on April 23, 2024

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

from flow.

yornaath avatar yornaath commented on April 23, 2024

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

from flow.

junosuarez avatar junosuarez commented on April 23, 2024

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

+1 demand :)

from flow.

tsing avatar tsing commented on April 23, 2024

+1 love this too.

from flow.

vjpr avatar vjpr commented on April 23, 2024

+1

I get Unexpected token function on my async keywords.

Is there anyway to workaround this?

from flow.

jtremback avatar jtremback commented on April 23, 2024

👍

from flow.

bhosmer avatar bhosmer commented on April 23, 2024

Async/await support added in v0.12.

from flow.

johngeorgewright avatar johngeorgewright commented on April 23, 2024

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

from flow.

samwgoldman avatar samwgoldman commented on April 23, 2024

@johngeorgewright can you give an example?

from flow.

johngeorgewright avatar johngeorgewright commented on April 23, 2024
/* @flow */

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

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

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

Found 1 error

from flow.

johngeorgewright avatar johngeorgewright commented on April 23, 2024
$  flow --version
Flow, a static type checker for JavaScript, version 0.14.0

from flow.

samwgoldman avatar samwgoldman commented on April 23, 2024

@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?

from flow.

sebmck avatar sebmck commented on April 23, 2024

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.

from flow.

johngeorgewright avatar johngeorgewright commented on April 23, 2024

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

from flow.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.