Comments (19)
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.
async/await is supported in regenerator proper right now; I think that es7-async-await package is old.
from flow.
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.
I should also mention that 6to5 uses Regenerator for its async
/await
support!
from flow.
+1
from flow.
It would be particularly awesome if Flow could somehow warn when exceptions might be swallowed by Promise
s!
from flow.
Yes async await would be a very nice addition! Any updates on progress? :) π
from flow.
it shouldn't be too hard to do in Flow too, once there is demand for it!
+1 demand :)
from flow.
+1 love this too.
from flow.
+1
I get Unexpected token function
on my async
keywords.
Is there anyway to workaround this?
from flow.
π
from flow.
Async/await support added in v0.12.
from flow.
I'm still getting errors for the await*
syntax.
from flow.
@johngeorgewright can you give an example?
from flow.
/* @flow */
function somethingParallel() {}
function somethingElseParallel() {}
async function somethingAsynchronous() {
await* [
somethingParallel(),
somethingElseParallel()
];
}
$ flow
.../test.js:7:8,8: Unexpected token *
Found 1 error
from flow.
$ flow --version
Flow, a static type checker for JavaScript, version 0.14.0
from flow.
@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.
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.
Ah, OK, sorry. So I'm to use await Promise.all()
... I hadn't realised that. Thanks.
from flow.
Related Issues (20)
- Bugs in negated `instanceof` expressions HOT 1
- [Question]: How to fix flowgen test after flow update HOT 3
- [Discussion]: Any plans to make Flow more interpopble with TS ecosystem? HOT 5
- Higher order type parameter support HOT 1
- Readme links to 404
- Strange index signature error if you use $Keys<O> instead of the equivalent literal union inside $ReadOnlyArray HOT 1
- [homebrew] automation script needs update HOT 2
- "Unxepcted identifier, expected the token ;" when using await inside of ES module HOT 3
- Can't iterate through chars in a string HOT 4
- Flow does not catch invalid switch statements HOT 1
- Conditional type only works if I inline it HOT 5
- Object with null prototype does not extend interface {} HOT 3
- Missing documentation for "render-types"? HOT 2
- Relay + graphql literals HOT 11
- [homebrew] regression test failure with 0.226.0,0.227.0 HOT 2
- FLOW BUG: This is a misplaced error HOT 3
- The `experimental.ts_syntax` doesnβt seem to do anything HOT 2
- Parameters<> does not support optional params HOT 2
- Top level exports HOT 1
- flow strict should allow unclear types for generics HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flow.