Hacker News new | ask | show | jobs
by YousefED 4370 days ago
I actually think microsoft is very much behind non-.net technologies as well nowadays.

My experience with their TypeScript initiative has been really smooth, feels like they're trying to improve JS instead of inventing something new (by sticking as close as possible to the ES.next specs). The generated JS is very close to the original, both in size as readability.

1 comments

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), 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.
Dart 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)

>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

What's library hell in JavaScript? I've never heard anyone use that term ever.

Any links for the perf issues you mentioned? There's some massive JS apps at Walmart and PayPal.

I mean there are many incompatible libs, module and import methods in JS
Also Dart can evolve at 10x speed that JS does (can you believe that Harmony still hasn't arrived?).