HACKER Q&A
📣 prmph

TS separate from JS would be awesome; why's no one working on it?


For example, TypeScript has this is significant limitation [1]. It's been open for close to six years. I suspect the difficulty of implementing it is in part due to having to maintain the proper relationship of TypeScript to JavaScript.

It would seem that a version, or fork, of TypeScript that is NOT a superset of JavaScript (but can compile to JavaScript, and probably web-assembly) would be a much cleaner. powerfully expressive language.

I bet that would be a _very_ popular language. We could have higher-kinded types; the module/import system could be cleaned up a lot; we could have a proper standard library, decimal and integer types, be able to use JSX natively, and so on. It would probably also be less complex to implement than TS as it exists now. So why isn't Microsoft and any other group working on this?

[1] https://github.com/microsoft/TypeScript/issues/1213

Edit: title shortened


  👤 stocktech Accepted Answer ✓
Because the second it's not javascript, you're going to lose 100x the audience. You'll also compete with all the other languages that can compile to Javascript and then the question is entirely different. CoffeeScript did something similar decades(?) ago when the ecosystem was vastly different and you could argue CoffeeScript provided more value - it still failed.

At the end of the day, Typescript is one way Microsoft is competing with Facebook. The only reason you want native JSX is because React won the framework wars. If Microsoft can win with Typescript, they'll have a larger say in the future of Javascript and then web development in general. They'll never move away from javascript.


👤 TomMarius
How about AssemblyScript? TypeScript tailored for WASM. It's early though.