TypeScript vs. FlowType
People definitely see the value of TypeScript and at the very least the tooling it makes possible. Even people that initially discredited TypeScript preventing bugs can now be seen exploring this thriving ecosystem (I am sure you know a few of these people).
However people continue to ask me (and others) about FlowType vs. TypeScript. Of course my opinion is biased. Honestly both are excellent choices. Its like writing good documentation and having empathy for your fellow developers. If you do that, then you are good person. My reasons for TypeScript preference are:
- `.ts/.tsx` extension. I like having type annotation in a .ts file whereas flow encourages you to have `.js` extension which feels like an upgrade / deprecations nightmare.
- Of course the current TypeScript ecosystem is significantly bigger then the flow one so if you are looking for future safety the answer is fairly obvious.
Debunking FlowType myths
There are a few misunderstanding out there that I have seen that are worth mentioning:
Both Flow and TypeScript, require you to be explicit type-checking of a particular file. For TypeScript the differentiator is the file extension
.ts whereas for Flow it is a comment on top of the file
// @flow. As soon as you switch either on in your project:
- You will most likely get errors in both TS and Flow e.g. for any undeclared variables.
- You get additional syntax opportunities that is a superset of JS.
More on bootstrapping
Its difficult to work on a developer tool without actually getting benefit to yourself from working on the developer tool. Suspect flow will go through a rewrite (after getting sufficiently annoyed by OCAML tooling) at some point, but TypeScript is already there.
Can’t I use both?
You can. But beware that there are significant syntax and semantic differences between the two.
If you liked this post click on the heart below. Any questions? I love to help🌹.