Hacker News new | ask | show | jobs
by perimo 4454 days ago
I contribute to the Doppio JVM project (https://github.com/int3/doppio), which we initially wrote in Coffeescript. About 9 months ago, we decided to port the whole thing (~10kloc) to Typescript, and it proved really useful:

- Typescript is a superset of Javascript (mostly), so we ported by converting all the Coffeescript sources to Javascript and renaming them with .ts extensions. There was a bit of cleanup involved in getting modules to play nice together, but most of the code ran without modification.

- The JS that the Typescript compiler generates is much easier to read, in part due to less "magic" in the language.

- It also makes performance much easier to reason about, for the same reasons. One issue that bit us several times was Coffeescript's auto-return feature, which was invisibly accumulating large arrays of values from our interpreter's bytecode loop! This is no longer a concern with the current Typescript codebase.

- The inner workings of the JVM are fairly complex, so enforcing types at compile-time actually does catch bugs before they happen.