5 ms·
disclaimer: I'm a huge fan of TypeScript and the folks working on it, but now work on Dart and JS stuff at Google, so I'm probably biased in all kinds of ways :
by jmesserly 12y ago
disclaimer: I'm a huge fan of TypeScript and the folks working on it, but now work on Dart and JS stuff at Google, so I'm probably biased in all kinds of ways :)
The way I like to think of it:
If the main thing you want in JavaScript is types and classes, TypeScript is brilliant. It adds exactly those things, and does so in a very attractive and seamless way. Classes are already in EcmaScript 6, and I wouldn't be surprised if TypeScript annotations make it into a future version ES (there's a strawman proposal: http://wiki.ecmascript.org/doku.php?id=strawman:types http://wiki.ecmascript.org/doku.php?id=strawman:types), so the forward compatibility story is good too.
If you want to fix more things in JS, such as:
* massively improve all core libraries and types
* improve the DOM
* add integers
* add operator overloading including [] []=
* make Map a distinct type, instead of all objects being maps
* switch from prototypes to classes
* removed undefined
* fix == operator
* remove implicit conversions
* tree shaking: no worries about which library is less KB's
* add named arguments
* add many features ES could add but at a faster velocity
* consistent libraries (e.g. Dart standardized on Futures)
* ... probably more stuff I'm forgetting ...
TL;DR -- TypeScript is a targeted fix, Dart tries to fix all-the-things. Both approaches have merit.
- seanmcdirmid 12y agoDart is a platform play influenced by Javascript with some JS interop, but mostly requires its own new libraries and ecosystem, which allows many things to be fixed. Typescript is a layer on top of Javascript and existing Javascript libraries that adds hybrid/latent typing. Typescript doesn't require a new ecosystem, but instead allows enhancements to the existing one. Both approaches are valid. (Disclaimer: MS employee, but had this discussion with Gilad a few weeks back)
- tkubacki 12y ago>Typescript is a layer on top of Javascript and existing Javascript libraries With all horrible issues JS has: unpredictable perf, library hell. Also my issues with TS are: 1) what if future ECMA will bring incompatible changes with current TS ? TS will break compatibility or we will have another EEE from MS ? Dart clean break seems like a safer approach. 2) there is no cross-platform IDE for TS (yea I know plugins - but Dart has stock cross-platform IDE) 3) TS perf will be always as good as JS
- _random_ 12y agoAlso Dart can evolve at 10x speed that JS does (can you believe that Harmony still hasn't arrived?).