8 ms·
Show HN: SharpTS – Run TypeScript Natively on .NET via AOT Compilation
Hey HN! I'm the author of SharpTS, a TypeScript interpreter and ahead-of-time compiler written in C#.
*What makes it different:*
- Dual execution modes - interpret TypeScript directly OR compile to native .NET executables
- Full C# interop - compile TypeScript to DLLs that C# projects can reference with full type safety
*What works today:*
- Core TypeScript: classes, interfaces, generics, async/await, decorators
- Advanced types: union/intersection types, literal types, type guards
- Compiles to verifiable .NET IL with performance comparable to hand-written C#
- 80+ unit tests, supports most of TypeScript's feature set
*Why I built it:*
I wanted to understand how TypeScript really works under the hood, and I thought .NET developers might appreciate being able to run TypeScript without Node.js. The AOT compilation to .NET IL was a fun challenge - mapping TypeScript's structural type system to .NET's nominal types required some creative solutions.
*Current limitations:*
- No npm module support (yet)
- Some advanced type system features are still in progress
- Standard library is partial (see STATUS.md)
The repo has detailed architecture docs if you're curious about the implementation details. Would love feedback, especially from TypeScript or compiler folks!
Example usage:
```
# Install
dotnet tool install -g SharpTS
# Interpret
sharpts script.ts
# Compile to .NET
sharpts --compile script.ts
dotnet script.dll
```
Happy to answer questions!
- ZJWCY 8mo agoIt's really cool! Will it support older .NET versions in the future?
- catlover76 8mo ago[dead]