Hacker News new | ask | show | jobs
by jeswin 148 days ago
Very interesting. I made a similar project called tsonic [1] which compiles TS to C# and then uses NativeAOT to compile it down to native code.

We'd have faced similar issues, and I'm curious how you solved it. From your examples:

  function add(a: number, b: number): number {
    return a + b;
  }
The challenge I faced here with JS/TS was that they have a single "number" type which can be carry ints, longs, floats etc. In most application code, you don't want a and b to be floats - you want them to be integers; such as in a loop counter. There are a whole bunch of types in native code that have no equivalent in TS.

It took me several months to get to a usable state, working on issues one by one.

This is a great project. Keep going, good luck.

[1]: https://tsonic.org