acdlite / flummox

Minimal, isomorphic Flux.
http://acdlite.github.io/flummox
1.69k stars 114 forks source link

Annotations for Flow Type Checker #41

Open pe3 opened 9 years ago

pe3 commented 9 years ago

In my understanding it would be possible since Flow 0.4.0 to annotate the Flummox API with type information. For Flummox users it would mean that you could statically check with Facebook Flow that you are calling Flummox the right way from your application code. Sounds tempting :-)

acdlite commented 9 years ago

I would love to use Flow, but need to wait for more complete ES6 support. https://github.com/facebook/flow/issues/62

emmenko commented 9 years ago

:+1:

chicoxyzzy commented 9 years ago

as far as I know Babel supports Flow annotations

acdlite commented 9 years ago

Babel will strip the annotations, but Flow itself doesn't support certain ES6 features, so type-checking won't work.

chicoxyzzy commented 9 years ago

there is a way to blacklist flow transformer https://github.com/babel/babel/issues/665#issuecomment-76526326

acdlite commented 9 years ago

Huh? Then what's the point?

chicoxyzzy commented 9 years ago

to run Flow on transpiled ES5 code with Flow annotations in it

acdlite commented 9 years ago

Ah, I see. So we would output the ES5 code to a directory called flow or something, and anyone who wants to use it would do require('flummox/flow') instead of require('flummox')?

chicoxyzzy commented 9 years ago

yep

acdlite commented 9 years ago

I like that idea. Do you know of any other libraries that are doing this? I've only played with Flow a bit, and I wonder if it would choke on any of extra code Babel adds.

chicoxyzzy commented 9 years ago

actually no but I saw some people speak about this on babel's gitter channel. I think all should work except runtime will be untyped. cc @sebmck

sebmck commented 9 years ago

@chicoxyzzy No idea how or why people use it. But Flow should accept and run all Babel ES5 output without a problem and if it doesn't then it'd be a bug in Flow.