Hacker News new | past | comments | ask | show | jobs | submit login

> What's the difference?

One lets you take existing JS-code and make use of new language features there. The other "just" lets you call existing JS-code.

I'd guess one is clearly better than the other when it comes to dealing with existing JS-code* . (While the other is clearly preferable to the one when it comes to making the language you want to make.)

* It still obviously depends a lot on the language. Like, how well TS-code works together with plain JS-code (how much do you get out of adding some type annotations here and there while leaving most of the JS-code untouched, etc.).




OK. So there is a path to converting JS to typescript without rewriting the whole thing. Thanks for the additional information.


I believe it is also possible to create definition files, like c++ header files, for existing libraries. So for instance, if you want the type checking for backbone, you could create a backbone.d.ts and just include the class/method/function definitions (and interfaces if you want to) and not even touch the original library. I would imagine this is the preferred way of doing things still I would imagine most libraries are not going to want to convert there libraries to include TypeScript only syntax.


Mostly the approach that personally makes TS interesting to myself is that typescript is building on top of javascript. You don't need to convert javascript to typescript because it already is typescript. Typescript simply extends the language. Dart or coffeescript on the other hand essentially creates an entirely new language that is simply compiled down to javascript.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: