Comments (55)
@webhipster @meagar and anyone else here, please check out #560.
from flow.
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
from flow.
short-hand object syntax ({ foo } turns into { foo: foo })
This one is supported :)
/* @flow */
var a = 'a';
var b = {a};
$> flow check
No errors!
from flow.
Not only that but when I tried to run it on my ES6 repos flow seemed to go into an infinite loop.
I killed it after 15 mins or so but it provided no feedback, I tried shorter runs with --profile
and that wasn't so helpful. I guess flow has an npm package resolver that allows it to follow CJS requires, correct?
Add modules to the ES6 list.
/home/brian/dev/global-compiler/src/cjs-require-remover.js:
Failure("Unimplemented: ExportDeclaration")
from flow.
ES6 compatibility is an explicit goal. We'll fix let
and for-of
right away, generators may be a bit longer (but soon).
from flow.
@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.
from flow.
@avikchaudhuri is support for const
also planned?
from flow.
Sure, we can add that too.
from flow.
@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
from flow.
Sure, otherwise what's the point? :)
from flow.
Fantastic :)
On Thu Nov 20 2014 at 10:51:35 AM Avik Chaudhuri [email protected]
wrote:
Sure, otherwise what's the point? :)
β
Reply to this email directly or view it on GitHub
#62 (comment).
from flow.
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!
from flow.
async\await would be nice also :)
from flow.
It would be nice to have destructive assignment support too.
function test({prop = 'defaultValue'}) { }
will error
Unexpected token =
from flow.
I'm using a lot of ES6 features via Traceur. I mainly need flow to support modules (import/export) and arrow functions.
from flow.
+1 for modules
from flow.
π
Please do it :)
from flow.
+1 for import
from flow.
+1 for modules
from flow.
+1 for let
and const
from flow.
+1 for async/await. Would love to use flow with 6to5.
from flow.
+1 for only supporting things that are directly relevant to type checking. Many of the new ES6 keywords have no effect on checking / inference.
from flow.
Modules please... :-)
from flow.
+1 for arrow functions
from flow.
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!
from flow.
Something that would be helpful here would be a checklist like in eslint/js#10 so that we can see how close we are.
from flow.
Also, :sadtrombone:, I had just tested:
var foo = function *() {
foooooooo()
}
And I didn't get any errors. I hand't tried actually putting in a yield statement yet. Sorry. Generators are still unsupported.
from flow.
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
from flow.
+1 Yes, let, const and modules. Babel+flow is a real alternative of typescript.
from flow.
+1 for using es6 with flow.
from flow.
Modules would be very nice. +1
from flow.
+1 modules
from flow.
+1 modules
from flow.
+1 modules!
from flow.
π for the modules, is it in the roadmap for the near future?
from flow.
@dialelo As far as I can tell, yes.
from flow.
What @ivanoats said. Can a collaborator please edit the issue description at the top to add a GFM checklist like this, and check things off as they are done?
I keep coming back to this thread to find out if Flow is compatible with my project yet, and a checklist would really help me out!
from flow.
+1 for a checklist
from flow.
Checklist would be awesome. +1
from flow.
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. π
from flow.
+1 for generators. Thank you so much for implementing modules!
from flow.
+1 for stop using this issue thread as a poll of specific unimplemented es6-features, however +1 for a checklist!
from flow.
+1. looking forward to let/const support
from flow.
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.
from flow.
@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 class
with a method, eg:
class MyClass {
func() {}
}
will cause babel to generate code that Flow believes is incorrect. Specifically the _createClass
generated line. Have you found a workaround for that? (and possible other generated code issues)
from flow.
@leeola in that case blacklisting es6.classes
will solve that issue since Flow understands ES6 classes.
from flow.
@ccapndave wouldn't that make all your flow errors report incorrect line numbers?
from flow.
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!
from flow.
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.
from flow.
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.
from flow.
@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 let
/const
, but have flow validate them as var
there are instructions in the "Let/const" pr comments: #431 (comment)
from flow.
+1 for let
const
from flow.
+1
from flow.
+1
from flow.
+1 for let
from flow.
Related Issues (20)
- 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
- Regression in invalid-computed-prop detection HOT 7
- Flow hangs every now and then requires restarting HOT 4
- Component syntax is not enabled HOT 5
- Alternative defaultProps not working with component syntax HOT 1
- Ability to copy all files and not only JS files when stripping types using `flow-remove-types` HOT 5
- Component syntax & unreachable code HOT 1
- Add a setting to turn off type guard removal / mutation risk check
- There is a question about `user friends` under limited login. When using limited login, the app only [get the user friends's app scoped IDs (ASIDs).](https://developers.facebook.com/docs/facebook-login/limited-login/permissions/#key-considerations-user-friends) **Can we get brief details about these user friends**, such like name, avatar, etc. It seems like we can't use graph API under limited login any more.
- [Proposal] Mark state & prop arrays in components & hooks as readonly HOT 5
- React.ElementType not working for children HOT 1
- Default arguments in an object destructure aren't checked for string literal unions HOT 1
- Regression with incompatible-type detection HOT 2
- Internal error on double underscore function name HOT 2
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.