Anyone have any experience with typescript vs. dart? I'm thinking of learning one of the two for frontend and wondered if anyone had any success or horror stories either way. Thanks!
I develop with both, and Dart wins hands-down. ES6/TS adds a lot of Dart's best features to JavaScript, but without getting rid of JS's annoying problems. Many here have mentioned that Dart's standard library is among the best there is, and that's no exaggeration. That alone makes it better.
Whenever I have a choice, I always use Dart. The tools (analyzer, profiler, etc.) automatically make me twice as productive as when I use JS.
Exactly. In the browser (and node) it's not really a question of how Dart compares to TS / ES6 (for example), but how Dart + ease of using JS libs compares to TS / ES6 + ease of using JS libs. And of course that makes sense.
TS is a language where the primary goal is seamless JS interoperability. Presumably, it will always make design tradeoffs to maintain that.
Dart is a language where the primary goal is developer productivity. The team decided that it required a clean break from JS to achieve that.
The tradeoff being that JS interoperability is harder.
So it's not a great surprise that TS wins in the JS interoperability front. Dart has made big improvements here recently and continue to do so and I expect the gap to continue to close but never quite go away.
Similarly, it's not a great surprise (to me at least) that Dart is a cleaner more productive language. As many have said ES6 has made big improvements over ES5 and coupled with TS has significantly closed the gap to Dart.
I see this trend continuing. With Dart maintaining an edge in language features + productivity and TS with JS interoperability ease, but the gaps in both aspects being small enough that it is a matter of personal choice and what best fits the project.
Dart uses map files for debugging in the browser, but if you use an IDE like JetBrains WebStorm or Eclipse, you can debug right in your editor environment without the provably harmful context switch.
The fact that typescript is a superset of javascript turns out to be huge in terms of adoption. Being able to start out writing javascript and gradually introduce typescript features (even in a well established codebase) is fantastic.
The javascript output is also saner and fairly predictable, so (for me at least) it is easier to reason about.