buildkite / frontend

🌏 The front-end application code for https://buildkite.com
MIT License
137 stars 27 forks source link

Flow++, part 1: emit PropTypes based on Flow types #774

Closed ticky closed 5 years ago

ticky commented 5 years ago

~As part of doing some dependency updates, I found a tool to convert PropTypes to Flow annotations, and a Babel plugin to emit PropTypes based on Flow annotations, so this might be a nice way to reduce the burden of switching to Flow. This is just me experimenting with using that.~

plasticine commented 5 years ago

Interesting! It’s unavoidable of course but the number of anys is a shame.

ticky commented 5 years ago

An any is at least a good first step on the road to being more specific! 😃

ticky commented 5 years ago

I’ve reduced this to just the bit that emits PropTypes based on Flow types. This means we get runtime checks for things called from legacy CoffeeScript, without having to write two sets of types, and that we also get Flow type checks as part of the build.

I’m going to put together PRs for auto-converting some of our PropTypes to Flow types separately.