DEV Community

Discussion on: TypeScript and why you should type your JS project

Collapse
 
matthewbdaly profile image
Matthew Daly • Edited

OK, I'll bite.

Flow offers many of the same advantages as Typescript. You can specify the shape of objects, define common interfaces, and so on, and Flow will pick up on type-related errors for you.

I'd also argue that using a language that extends Javascript is potentially risky. You can always bet on Javascript being available in the future, but languages that compile to Javascript have a rather shaky history (can't be too much support for Coffeescript left, for example). Plus, Microsoft's track record on embrace, extend and extinguish is something to be wary of. By contrast, Flow was always implemented as just a set of annotations on top of Javascript that can be stripped out by a simple Babel transform.

For those reasons I opted for Flow over Typescript, and I have no plans to change anytime soon. I'm of the opinion that it's a better solution to the same problem, and provides similar benefits.

I will say that I regard both Flow and Typescript as transitional solutions - adding equivalent functionality to the Javascript language would be a far, far better solution.