SharpTS
A TypeScript interpreter and AOT compiler for .NET
dotnet tool install -g SharpTS
// Run TypeScript directly on .NET
interface Greeter {
greet(name: string): string;
}
class WelcomeBot implements Greeter {
constructor(private prefix: string) {}
greet(name: string): string {
return `${this.prefix}, ${name}! Welcome to SharpTS.`;
}
}
const bot = new WelcomeBot("Hello");
console.log(bot.greet("Developer"));
// → Hello, Developer! Welcome to SharpTS.What SharpTS Does
A complete TypeScript runtime and compiler built entirely in C#
Interpret
Tree-walking execution with instant startup. Perfect for scripting, REPL sessions, and rapid prototyping.
Compile
AOT compilation to standalone .NET assemblies. Ship native binaries with full .NET performance.
.NET Interop
Access .NET BCL types directly via @DotNetType decorators. Bridge TypeScript and C# seamlessly.
Full TypeScript
Types, generics, classes, interfaces, modules, decorators, mapped types, conditional types, and more.
Async & Generators
Full async/await support, Promise combinators, generator functions, and async iterators.
Module System
ES6 imports/exports, namespaces, dynamic imports, re-exports, and CommonJS interop.
See It In Action
Real TypeScript running on the .NET runtime
const greeting: string = "Hello from SharpTS!";
const version: number = 1.0;
console.log(`${greeting} v${version}`);
const languages = ["TypeScript", "C#", ".NET"];
languages.forEach(lang => console.log(` ✓ ${lang}`));Hello from SharpTS! v1 ✓ TypeScript ✓ C# ✓ .NET
How It Works
A multi-stage pipeline from source to execution
Implementation Status
Comprehensive TypeScript language support
Type System
| Feature | Status | Notes |
|---|---|---|
| Primitive types | Implemented | |
| Generics | Implemented | Full support with constraints |
| Union & Intersection types | Implemented | |
| Literal types | Implemented | |
| Tuple types | Implemented | Optional, rest, and named elements |
| Conditional types | Implemented | infer keyword, distribution |
| Mapped types | Implemented | keyof, indexed access |
| Template literal types | Implemented | |
| Utility types | Implemented | Partial, Required, Pick, Omit, etc. |
Classes & OOP
| Feature | Status | Notes |
|---|---|---|
| Classes & inheritance | Implemented | |
| Access modifiers | Implemented | |
| Abstract classes | Implemented | |
| Getters/Setters | Implemented | |
| Private fields (#field) | Implemented | |
| Static blocks | Implemented | |
| Decorators | Implemented | Legacy & TC39 Stage 3 |
| Method overloading | Implemented |
Functions & Async
| Feature | Status | Notes |
|---|---|---|
| Arrow functions | Implemented | |
| Rest/spread | Implemented | |
| Closures | Implemented | |
| async/await | Implemented | |
| Promise.all/race/any | Implemented | |
| Generators (function*) | Implemented | |
| Async generators | Implemented | |
| for await...of | Implemented |
Modules
| Feature | Status | Notes |
|---|---|---|
| import/export | Implemented | |
| Default exports | Implemented | |
| Namespace imports | Implemented | |
| Dynamic imports | Implemented | |
| TypeScript namespaces | Implemented | |
| import type | Implemented | |
| Module augmentation | Implemented |
Built-in APIs
| Feature | Status | Notes |
|---|---|---|
| console.log | Implemented | Printf-style format specifiers |
| Math object | Implemented | |
| String methods | Implemented | 40+ methods |
| Array methods | Implemented | 50+ methods |
| Map/Set | Implemented | ES2025 Set operations |
| RegExp | Implemented | |
| Date | Implemented | |
| JSON | Implemented | |
| Promise | Implemented | |
| Symbol | Implemented | |
| Proxy | Missing | |
| WeakRef | Missing |
Advanced
| Feature | Status | Notes |
|---|---|---|
| using/await using | Implemented | TS 5.2+ resource management |
| satisfies operator | Implemented | |
| Const type parameters | Implemented | |
| bigint type | Implemented | |
| TypedArrays | Implemented | |
| SharedArrayBuffer/Atomics | Implemented |
Interactive Playground
Write TypeScript and run it on .NET — right in your browser
Get Started
Up and running in three steps
Install
Install SharpTS as a .NET global tool
dotnet tool install -g SharpTSWrite
Create a TypeScript file
interface Config {
name: string;
debug: boolean;
}
const config: Config = { name: "MyApp", debug: true };
console.log(`Starting ${config.name}...`);Run
Interpret directly or compile to a .NET assembly
# Interpret (instant startup)
sharpts hello.ts
# Compile to .NET assembly
sharpts --compile hello.ts -o hello