Releases: nickna/SharpTS
v1.0.5
Release Notes - v1.0.5
Highlights
This release brings major advancements, including Node.js built-in module support, async generators, class expressions, full iterator protocol, and significant compiler improvements.
Node.js Built-in Modules
Full or partial implementations of Node.js core modules:
- fs - File system operations with named imports
- path - Path manipulation utilities
- process - Process info, stdin/stdout/stderr streams, argv
- crypto - Cryptographic functions and hash support
- util - Utility functions
- readline - Interactive input
- child_process - Spawn child processes
- querystring - Query string parsing
- url - URL parsing and manipulation
- assert - Assertion testing
Async/Await & Generators
- Async generators - Full IL compiler support for
async function* - Iterator protocol - Custom iterators with
$IteratorWrapperclass - Generator improvements - Hoisted enumerator support, outer variable capture
- Promise enhancements -
Promise.anysupport, proper nested Promise flattening
Class & Type System
- Class expressions - Full support in both interpreter and IL compiler
- Conditional types -
T extends U ? X : Ysyntax - Template literal types - Intrinsic string manipulations (
Uppercase,Lowercase, etc.) - Generic type aliases - Enhanced generic handling with array suffixes
- TypeScript utility types -
Partial,Required,Readonly,Record,Pick,Omit,ReturnType,Parameters,ConstructorParameters,InstanceType,ThisType,Awaited,NonNullable,Extract,Exclude - Union types - Improved handling with implicit conversions and
IUnionTypeinterface - Interface inheritance - Proper propagation during type-checking
- Control flow type narrowing - Termination analysis in TypeChecker
Language Features
- Strict mode -
"use strict"directive support - Dynamic imports -
import()with module registry import.meta- Access to module metadataas const- Const assertions- Import aliases -
import { x as y }declarations - Non-null assertion -
!operator support - Decorators - .NET attributes via TypeScript decorators (
@attribute) - Logical assignment operators -
&&=,||=,??= - Numeric separators -
1_000_000syntax - Optional catch binding -
catch { }without parameter typeofandkeyof- Operators in type expressions
Object & Array Methods
Object.freeze(),Object.seal(),Object.isFrozen(),Object.isSealed()Object.assign(),Object.fromEntries(),Object.hasOwn()Array.of(),Array.from()- Variadic
push(), enhancedsplit()with limit parameter
Runtime Improvements
- WeakMap and WeakSet - Validation and runtime emitter support
- Error class - Full implementation with subtypes (
TypeError,RangeError, etc.) $TSDateclass - Date handling support$Undefinedsingleton - Proper undefined handling- BigInt - Centralized handling with compound operators
Compiler (IL) Improvements
- ValidatedILBuilder - Refactored into multiple files with validation
- StateMachineEmitHelpers - Centralized state machine emission logic
- ExpressionEmitterBase / StatementEmitterBase - Unified emission patterns
- LocalVariableResolver - Improved variable access handling
- Type provider pattern - Better type resolution in RuntimeEmitter
- Performance - Memoization for type compatibility checks, cached union/intersection types
CLI & Developer Experience
--helpand--version- CLI commands- Output targets - Support for both DLL and EXE compilation
- Improved error handling - Better compile command errors and usage instructions
Performance Optimizations
- String concatenation using
string.Concat - Cached flattened types in Union/Intersection records
- Memoization for type compatibility checks
- Centralized primitive type mappings
Bug Fixes
startsWithandendsWithin IL compilation- Binding logic for
SharpTSFunctionin iterator handling - Parser error handling and recovery improvements
- Namespace merging for nested namespaces
- Null safety in argument handling
Full Changelog: v1.0.4...v1.0.5
v1.0.4
SharpTS v1.0.4 Release Notes
Release Date: January 11, 2026
This release introduces full .NET interoperability, thread-safety primitives, improved error reporting, and significant internal refactoring for maintainability.
New Features
.NET Interoperability
SharpTS can now directly consume .NET types from TypeScript code:
@DotNetTypedecorator - Map TypeScript classes to .NET types for seamless interopdeclare classsyntax - Declare .NET types in TypeScript with full type safety--gen-declCLI option - Auto-generate TypeScript declarations from .NET assemblies-r/--referenceoption - Reference external .NET assemblies at compile time- Overload resolution - Automatic .NET method overload selection based on argument types
- Type conversion - Seamless conversion between TypeScript and .NET types
@DotNetType("System.Text.StringBuilder")
declare class StringBuilder {
constructor();
Append(value: string): StringBuilder;
ToString(): string;
}
const sb = new StringBuilder();
sb.Append("Hello, ").Append(".NET!");
console.log(sb.ToString());Thread-Safety with @lock
New @lock decorator for thread-safe method execution:
- Works with both instance and static methods
- Reentrancy-safe using Monitor and AsyncLocal
- Prevents race conditions in concurrent scenarios
class Counter {
private count = 0;
@lock
increment(): void {
this.count++;
}
}Improved Error Reporting
Structured exception hierarchy with precise error locations:
TypeMismatchException- Type incompatibility errorsInvalidCallException- Invalid function/method callsTypeOperationException- Invalid type operationsUndefinedMemberException- Missing property/method access
All exceptions now include line and column information for better debugging.
TypeScript-Style Excess Property Checking
Object literals are now validated against their expected types:
interface Point { x: number; y: number; }
const p: Point = { x: 1, y: 2, z: 3 }; // Error: 'z' does not exist on type 'Point'Improvements
Performance Optimizations
- Property lookup caching in class instances
- FrozenDictionary/FrozenSet for immutable type collections
- Optimized reflection with caching strategies
- Improved BigInteger emission and locals management
Compiler Enhancements
- Type-first dispatch for built-in TypeScript types
- Refactored class type handling with MutableClass builder
- Improved value type handling in IL emission
- Better argument conversion for .NET interop
Infrastructure
MSBuild SDK
New SharpTS.Sdk package for MSBuild integration:
- Custom
ReadTsConfigTaskfor tsconfig.json parsing - Seamless integration with .NET build pipelines
- Automatic TypeScript compilation during build
Benchmarks Project
Added SharpTS.Benchmarks for performance testing and regression tracking.
Internal Refactoring
Major code organization improvements for maintainability:
- Split large classes into partial files for better navigation
- Converted exception-based control flow to
ExecutionResultpattern - Refactored analyzers to use visitor pattern
- Reorganized IL emitters by domain (Arrays, Objects, Promises, JSON, etc.)
Upgrading from v1.0.3
This release is backwards compatible with existing TypeScript code. Note these changes:
- Exception types - If you catch SharpTS exceptions programmatically, update to use the new structured exception types
- Excess property checking - Object literals with extra properties will now produce type errors
Documentation
Full Changelog: v1.0.3...v1.0.4
v1.0.3
SharpTS v1.0.3
Announcing SharpTS v1.0.3! This release brings major new language features, significant performance improvements, and important bug fixes.
What's New
Async/Await & Promises
Full async/await support is here! Write asynchronous TypeScript code that compiles to native .NET async state machines:
async/awaitkeywordsPromise<T>with.then(),.catch(),.finally()Promise.all(),Promise.race(),Promise.any(),Promise.allSettled()
Module System
Build multi-file TypeScript projects with ES6-style modules:
import/exportwith named, default, and namespace imports- Dynamic
import()expressions - Multi-module compilation support
Generators & Iterators
Create custom iterables with generator functions:
function*generator syntaxyieldexpressions- Iterator protocol support
New Built-in Types
- RegExp - Regular expression support
- Date - Full Date object implementation
- Map/Set - Collection types
- BigInt - Arbitrary precision integers
- Symbol - Unique identifiers as object keys
Advanced Type Features
- Decorators - Legacy and TC39 Stage 3 decorator support
- Namespace declarations - Organize code into namespaces
- Mapped types - Transform types programmatically
- Abstract classes - Define class contracts
- Intersection types - Combine multiple types
- Method overloading - Multiple signatures for methods
- Const enums - Compile-time enum inlining
- Computed property names - Dynamic property keys
C# Interop
Generate reference assemblies for seamless C# consumption:
sharpts --compile mylib.ts --ref-asmYour TypeScript classes become strongly-typed C# classes!
Performance Improvements
- Numeric boxing optimization - Numeric values stay unboxed through arithmetic chains
- Type-aware method dispatch - Direct calls for known types skip dynamic lookup
- Dead code elimination - Unused code is automatically removed from output
- Stack type tracking - Improved IL generation reduces unnecessary operations
Bug Fixes
- Fixed
Math.round()to match JavaScript behavior - Fixed
thisbinding in object methods during IL compilation - Fixed Promise callback handling in compiled code
- Fixed increment/decrement on properties and array indices
- Fixed cross-platform assembly reference resolution
- Fixed various IL stack type tracking issues
Getting Started
Install via NuGet (recommended)
dotnet tool install -g SharpTSUpgrade existing installation
dotnet tool update -g SharpTSRun your first script
sharpts script.ts # Interpret
sharpts --compile script.ts # Compile to .NETResources
Full Changelog: v1.0.2...v1.0.3
v1.0.2
🎉 Initial Release
SharpTS v1.0.2 is the first release of a TypeScript interpreter and ahead-of-time compiler written in C#.
Highlights
- Dual Execution Modes: Tree-walking interpreter for rapid development and AOT compilation to native .NET assemblies
- TypeScript Language Support: Types, arrays, objects, classes, interfaces, functions, control flow, and error handling
- Static Type Checking: Comprehensive type validation with nominal typing for classes and structural typing for interfaces
- Built-in Features:
console.log,Mathobject, string/array methods, and more - CI/CD: GitHub Actions workflow for automated NuGet package publishing
Getting Started
# Install from NuGet
dotnet tool install --global SharpTS
# Run TypeScript file
dotnet run -- script.ts
# Compile to .NET assembly
dotnet run -- --compile script.tsSee the README for full documentation.
Full Changelog: https://github.com/nickna/SharpTS/commits/v1.0.2