-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Support for ES6 features #62
Comments
This one is supported :) /* @flow */
var a = 'a';
var b = {a}; $> flow check
No errors! |
Not only that but when I tried to run it on my ES6 repos flow seemed to go into an infinite loop. Add modules to the ES6 list.
|
ES6 compatibility is an explicit goal. We'll fix |
@briandipalma Hmm, if Flow goes into an infinite loop that's a bug, so providing more information would be helpful (like if you could narrow down to one file that's causing it). We'll put more logging information in the binary to make it useful to do this kind of debugging. On the other hand, it may be that there's a particularly large file or a file with a lot of reflection in your repo and that's causing Flow's type inference to be ridiculously confused. Again, would be good to know which file. |
@avikchaudhuri is support for |
Sure, we can add that too. |
@avikchaudhuri I should have been more clear, but I was also wondering if flow will enforce the const so that this will be an error: const x = 5;
x = 6; // Error cannot reassign const |
Sure, otherwise what's the point? :) |
Fantastic :) On Thu Nov 20 2014 at 10:51:35 AM Avik Chaudhuri [email protected]
|
fwiw, my vote priority-wise is generators and then let/const. Generators are the biggest thing holding me back from using it. I know it'll get there though! |
async\await would be nice also :) |
It would be nice to have destructive assignment support too.
will error
|
I'm using a lot of ES6 features via Traceur. I mainly need flow to support modules (import/export) and arrow functions. |
+1 for modules |
👍 |
+1 for import |
+1 for modules |
+1 for |
+1 for async/await. Would love to use flow with 6to5. |
+1 for only supporting things that are directly relevant to type checking. Many of the new ES6 keywords have no effect on checking / inference. |
Modules please... :-) |
+1 for arrow functions |
Are +1's helpful? The things that I'm really hoping for are import/export, const/let, and generators. Edit: It looks like generators are happy now I think. Thanks! |
Something that would be helpful here would be a checklist like in eslint/js#10 so that we can see how close we are. |
Also, :sadtrombone:, I had just tested:
And I didn't get any errors. I hand't tried actually putting in a yield statement yet. Sorry. Generators are still unsupported. |
Is there any update on this? The support for es6 modules would be really something to look forward to. Currently a show stopper for me as the whole project here is purely written in es6 using babel |
Could we add getter/setter methods to the list? class MyList<T> {
list: T[];
constructor(list: T[]) { this.list = list; }
get length() { return this.list.length; }
}
new MyList([1,2,3]).length |
+1 modules! |
👍 for the modules, is it in the roadmap for the near future? |
+1 for a checklist |
Checklist would be awesome. +1 |
Is there a status page on what ES6 features are currently supported? Would be nice to have a quick overview. I keep running into blockers when implementing flow in my ES6 projects. Edit: Should of read the previous comments. A checklist would be great. 👍 |
+1 for generators. Thank you so much for implementing modules! |
+1 for stop using this issue thread as a poll of specific unimplemented es6-features, however +1 for a checklist! |
- adds a gulp task (not baked into "watch" yet because Flow is pretty broken right now with respect to a lot of ES6 features[*]) - updates license headers to include `@flow` pragma (I wanted to use `gulp-flowtype`'s `all` option, but that doesn't seem to work; Flow seems to want to scan everything in `node_modules`, even though gulp is set to watch only files under `src/`) So, very much a work in progress. It might be useful eventually. [*]: See facebook/flow#62; the version of Flow currently on Homebrew (0.11.0) doesn't support `const`, which I use all over the place, as well as a number of other features.
+1. looking forward to let/const support |
Note that you can get most ES6 feature in Flow right now by running your code through Babel with the flow blacklist. http://www.keendevelopment.ch/flow-babel-gulp-es6/ has a recipe for doing this. |
@ccapndave The problem with that, at least in my case, is that Flow can have problems with the generated code from Babel. Eg, for me even using
will cause babel to generate code that Flow believes is incorrect. Specifically the |
@leeola in that case blacklisting |
@ccapndave wouldn't that make all your flow errors report incorrect line numbers? |
I don't use classes in ES6 so I couldn't say for sure, but I think the sourcemaps will figure it all out. Have a go and let us know! |
Thanks for your input, everyone! I'm organizing the existing issues around this and taking @callumlocke's advice to create a checklist. To that end, I'm merging this with #560. |
I'm not normally one to complain, but as of flow 0.13.1 I'm still waiting for const/let. I would really love to use flow, but I have a lot of let and const in my project. Thanks. |
@Hector409-hmg Work is being done (or at least was until recently). They're implementing it the "proper" way. If you just want to be able to use |
+1 for |
+1 |
Parse object type indexer properties
+1 |
+1 for |
@webhipster @meagar and anyone else here, please check out #560. |
I didn't see an existing issue for this, nor do I see anything on the website about it, but I'm sure you all have plans for this. Looks like there are several ES6 features this doesn't support yet, particularly
let
:I'm interested in using this as a "light" type checker in Firefox. I don't know if we'll ever start adding a lot of type declarations, but this looks like it could be a nice "linter" using the weak mode. (still not sure how far that goes yet, but if it can even catch a few things that would be cool).
Since we can code against SpiderMonkey, we use ES6 a lot, like:
let
/const
{ foo }
turns into{ foo: foo }
)That's just off the top of my head. On the file I tried, the main things I hit were let/const and for-of.
The text was updated successfully, but these errors were encountered: