Hacker News new | past | comments | ask | show | jobs | submit login
Ask HN: Any interesting forks of TypeScript (or languages inspired by it)?
5 points by prmph 54 days ago | hide | past | favorite | 4 comments
What would TypeScript look like if it were freed from the shackles of JavaScript? Could it be a first class language compiled to machine code, .NET IL, or wasm, with runtime type checking, and cleaner and less bloated?

Are there any forks of Typescript (or TypeScript-like languages) exploring these ideas?

Rationale for Question: After using TypeScript for some years, I find C#, as good a language as it is, fairly clunky. C# lacks many things that make TypeScript so expressive: straightforward first-class functions and union types, for example. I think my ideal language would be something that marries the best parts of C# and TypeScript.




There is AssemblyScript, a more basic language targeting WASM directly. https://www.assemblyscript.org/

AssemblyScript seems like it can become the Cython for TypeScript - close enough to mainline TS that you could consider porting or lowering some of your existing application for performance. However as a WASM only language, the use cases are quite specific.

I think I would prefer to rewrite slow algos in Rust, where they could be re used natively in a wider variety of contexts like inside a native app or in a native Rust backend service.


Here is a listing of some TypeScript derived languages: https://github.com/orta/awesome-typescript-derived-languages

Of those, Static TypeScript has been of particular interest to me, but it seems either out of date, or the info available is.


Just to add to this—the reason I find Static TypeScript particularly interesting is that it is a Microsoft project:

https://github.com/microsoft/pxt/tree/master/pxtcompiler

Compiling TypeScript to other targets is a significant challenge, so I think that in order for a project to become a viable alternative, it will need the resources of a big company like MS behind it. However, I'm not sure if MS or any other company currently has a great incentive to invest heavily in that. Running TypeScript on Node or Deno is good enough for most applications, and for apps that require better performance, MS already has C#, which was architected from the start to be performant (for example, allowing apps to use just value types / structs so that the GC isn't used).


I also find Static TypeScript interesting because it’s so relatively obscure compared to AssemblyScript, but much closer to regular TypeScript. And because I suspect there are opportunities to use it, at least partially, in build tooling scenarios where the equivalent JavaScript (Babel/estree etc AST transforms) is a particularly poor experience and most of the alternatives involve rewriting in Rust or whatever.

I also wonder how much of the challenge of compiling [whatever subset of] TypeScript is rooted in the fact that dependencies are almost universally shipped as JavaScript. Apart from the highly dynamic nature of many front end libraries, idiomatic TypeScript usually provides a great deal more static analysis potential than is probably in use.




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

Search: