facebook / flow

Adds static typing to JavaScript to improve developer productivity and code quality.
https://flow.org/
MIT License
22.09k stars 1.86k forks source link

When using a different @jsx pragma, components are not type checked. #5469

Open mkellyclare opened 6 years ago

mkellyclare commented 6 years ago

Started seeing this after upgrading past flow v0.53 and adding the // @jsx h pragma at the top of the file. It appears that any of the type checks on Preact components no longer work.

For a React component and Preact component with an incorrectly typed prop passed to them, only the React component complains about the incorrect type. I created a minimal example here to reproduce the problem. Just run

yarn && yarn run flow

to see the issue.

Am I missing some configuration or is it not possible to type check Preact components any more? @asolove In a previous ticket you mentioned you had preact and flow typing working - does this still work for you?

rfreitas commented 6 years ago

+1 on this

btw, I feel this should be part of a larger piece of integrating with babel pragma configuration. If flow has to be coupled with something, probably better to couple it with babel than with React.

ArmorDarks commented 6 years ago

Ah, so this is indeed a bug. And I was wondering what I'm doing wrong https://github.com/facebook/flow/issues/6626#issuecomment-421484116