flummox icon indicating copy to clipboard operation
flummox copied to clipboard

Annotations for Flow Type Checker

Open pe3 opened this issue 10 years ago • 12 comments

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 :-)

pe3 avatar Feb 23 '15 08:02 pe3

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

acdlite avatar Feb 24 '15 19:02 acdlite

:+1:

emmenko avatar Mar 10 '15 12:03 emmenko

as far as I know Babel supports Flow annotations

chicoxyzzy avatar Mar 27 '15 02:03 chicoxyzzy

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

acdlite avatar Mar 27 '15 02:03 acdlite

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

chicoxyzzy avatar Mar 27 '15 03:03 chicoxyzzy

Huh? Then what's the point?

acdlite avatar Mar 27 '15 03:03 acdlite

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

chicoxyzzy avatar Mar 27 '15 03:03 chicoxyzzy

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')?

acdlite avatar Mar 27 '15 03:03 acdlite

yep

chicoxyzzy avatar Mar 27 '15 03:03 chicoxyzzy

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.

acdlite avatar Mar 27 '15 03:03 acdlite

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

chicoxyzzy avatar Mar 28 '15 19:03 chicoxyzzy

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

sebmck avatar Mar 29 '15 05:03 sebmck