Hacker News new | ask | show | jobs
by jahooma 4462 days ago
Hmm, that was pretty one-sided.

The author fails to acknowledge any of the good consequences of typescript. Adding static typing, classes, modules, enums, shorter anonymous method syntax, default arguments, etc. etc. make a world of difference for writing clean, structured code that is rid of a whole class of bugs at compile time. It's simpler to read, easier to write, and more likely to be correct in typescript. And the intellisense in Visual Studio is phenomenal. Contrary to what he says, I think typescript does tackle head on the biggest problems of javascript and makes massive improvements.

Regarding type definitions, I've never had problems getting correct type definitions for all the libraries I use, and it's also always possible to just not use type definitions as a backup. He forgets to mention how great it is to be able to use any javascript library straight up (unlike most compile-to-javascript languages) -- and that in 99% of the cases there are existing type definitions which add on static types to regular javascript.

That's right, in perhaps one of the most brilliant features, typescript lets you add types after the fact to any javascript library, and it works well. Thus, IMHO, most javascript libraries are actually better in typescript!

Though typescript doesn't fix every problem (like the mechanics of what "this" refers to, although it helps here too), you almost don't want it to fix these, because only this way can you use regular javascript and its vast libraries so simply.

Typescript has always been a sort of compromise between making a better statically typed language and retaining a javascript core for compatibility, but this balance is executed so well that you just about have the best of both worlds.