flowtype.s
Last updated
Last updated
Flowtype is awesome:
it successfully replaces unit tests for some tasks, like ensuring that the different parts of the app, remains in sync with each others.
it give you autocompletion
That being said, if flow is misconfigured and you blindly trust the result, you can still have bug where it should have raised an alert for you.
Every *.js
file should have a comment on first line of the code with // @flow
.
Why?
If it is not, the file is ignored by flow.
Every types should use exact typing {|...|}
and not {...}
What?
Why?
If you make a typo in React
, you can see it, for instance.
If you make a typo in React
, you can don't see it.
If you make a typo in PropsType
, you can see it.
(myFavoriteGoat
should raise an error, but don't since PropsType
are not exact)