I was always wondering why HN crowd is ok with TS and so prejudiced against Dart - Dart has NG2, await async in older browsers and good tooling (webstorm, vscode) and much saner package system. When doing lot of small web apps - it's easier to mantain.
If TypeScript is so great, how come all notable ReactJS projects use Babel?
41–50 of 247 posts
Re: If TypeScript is so great, how come all notable ReactJS projects use Babel?
#42Compatible should be same files, new compiler = "just works".
Re: If TypeScript is so great, how come all notable ReactJS projects use Babel?
#43Re: If TypeScript is so great, how come all notable ReactJS projects use Babel?
#44Earlier quoted context omitted.
It's tempting to think this way, but it's a performance/complexity nightmare. If everything is a plugin, then you need ways for different parsers to talk to each other to deal with nested syntax, plus ways for different syntactic transformers to correctly handle nesting of certain things. For example, if you desired to implement a plugin for "thin arrows", and a plugin for JSX, how would you parse this? const x = } /…
Aren't the Babel people trying to define a common standard format for the AST so different parsers and code generators can better work together? That said, if you look at TS as a superset of Babel plugins, there's actually not much to TS that is TS-specific. Adding that to Babel would be relatively simple. You seem to be arguing it's a slippery slope. We're not talking about arbitrary syntax. We're talking about a fa…
Actually kind of the opposite - babel used to use the common ESTree AST format, but they've moved away to something similar but incompatible.
Re: If TypeScript is so great, how come all notable ReactJS projects use Babel?
#45Speaking as the person who implemented JSX support for TypeScript, I question the premise! JSX support (and implementation of React semantics for typechecking that JSX) was a very popular feature request. I can tell you just from how quickly people notice when something JSX-related changes in the nightly build that there are a lot of people using TypeScript with React. Also, since this seem to be a popular misconcept…
i suspect a great many typescript users are not open source.
Re: If TypeScript is so great, how come all notable ReactJS projects use Babel?
#46I do not believe compilation nor a type system belong in JavaScript. It's better to have something like "Flow" that does static analysis of the code as you write. I might even go as far as putting on a "tin foil hat" and state that Typescript is a trick to lock you into their proprietary ecosystem of expensive tools that everyone have to buy into just to communicate with you once you are locked in.
I only see advantages for static typing for a small cost of time: you prevent most of Type Error from happening, you get automatic auto-completion, refactoring errors are easier to catch and feel safer. Either way, you need to specify the type of the arguments in the documentation of your function (I can sometimes even find the C# LINQ's function I'm looking for just by looking at the return type of the list of function).
You could even use Flow and Typescript to catch
Aside from the proprietary reasons (which I believe are unfounded since the whole Typescript ecosystem is opensource), why do you think static typing doesn't belong in Javascript ?
Re: If TypeScript is so great, how come all notable ReactJS projects use Babel?
#47I do not believe compilation nor a type system belong in JavaScript. It's better to have something like "Flow" that does static analysis of the code as you write. I might even go as far as putting on a "tin foil hat" and state that Typescript is a trick to lock you into their proprietary ecosystem of expensive tools that everyone have to buy into just to communicate with you once you are locked in.
Re: If TypeScript is so great, how come all notable ReactJS projects use Babel?
#48Re: If TypeScript is so great, how come all notable ReactJS projects use Babel?
#49Because a lot of notable ReactJS projects are irritatingly enamored with all the latest ES6/ES7/ESCloudCuckooLand features, not all of which are supported by TypeScript. I've noticed this a lot in the Redux realm. For every possible problem there seems to be a solution that harnesses one particular new/proposed bell & whistle.
This is another reason: > If you work outside the San Francisco bubble and are stuck on Windows, Flow isn't really an option at the moment.
Re: If TypeScript is so great, how come all notable ReactJS projects use Babel?
#50I do not believe compilation nor a type system belong in JavaScript. It's better to have something like "Flow" that does static analysis of the code as you write. I might even go as far as putting on a "tin foil hat" and state that Typescript is a trick to lock you into their proprietary ecosystem of expensive tools that everyone have to buy into just to communicate with you once you are locked in.