3 ms·
"without the types your code is perfectly valid JS, which is what actually happens via a simple Babel transform" This is literally exactly the same amount of t
by RyanCavanaugh 9y ago
"without the types your code is perfectly valid JS, which is what actually happens via a simple Babel transform"
This is literally exactly the same amount of true for TypeScript as it is for Flow
- STRML 9y agoThey're different. Flow is not a "superset" of JS in that it introduces new features, it only introduces new types of annotations. Remove all the annotations (literally delete them), and you have valid ES6. Typescript has its own class system, public/private/protected, and its own compiler. This was a big negative while ES6 was still brand new and the TS compiler was catching up, but now it's pretty much a wash between the two. A year ago, I would have said Flow, no question. Today, TS has really caught up and the tooling is better, no doubt. It depends on how complex your types are - Flow can express types TS can't, but TS has an incredible ecosystem and far fewer bugs. In the end, it's all about reducing bugs in your own application, and TS seems to do that better in the end despite its limitations.
- WorldMaker 9y agoThe class system was already an EcmaScript proposal at the time Typescript adopted it, and what Typescript launched with was directly based on the ES proposal at the time. The proposal shifted a bit before it was finalized and TS did the necessary catch-up work to the final accepted specification. It hasn't added anything whole cloth other than types that wasn't in some stage or another an ES proposal. (From that perspective TS has always been Flow + a few curated Babel plugins.)
- ng12 9y agoSee my comment above, but this is not true. The output of the type stripping is exactly your code without types. This is not true for Typescript.
- woah 9y agoNot true. Typescript does all kinds of transforms. Flow does nothing except catch type errors, and then it is simply stripped out. Nothing else in the code is touched at all.