Skip to content

tsoniclang/runtime

Repository files navigation

Tsonic.Runtime

TypeScript language runtime primitives for the Tsonic compiler.

Overview

Tsonic.Runtime contains mode-independent primitives used by Tsonic-generated C# in CLR, JavaScript-surface, Node-style, and ASP.NET Core projects.

The runtime provides:

  • Union carriers - Union<T1, T2, ...> for TypeScript unions like string | number
  • Structural carriers - Structural.Clone<T>(), Structural.CloneFromDictionary<T>(), and DictionaryAdapter<T> for closed generated structural conversion
  • Dynamic object carrier - DynamicObject for compiler-owned indexed access and dictionary-shaped projections
  • Operator helpers - deterministic typeof and instanceof support
  • JSON helpers - JSON.parse<T>() and JSON.stringify(...) for generated code paths that use closed structural metadata

When to Use

This library is referenced by all Tsonic projects.

  • CLR/default-surface projects use Tsonic.Runtime
  • First-party source surfaces such as @tsonic/js, @tsonic/nodejs, and @tsonic/express also use Tsonic.Runtime

What's NOT Here

JavaScript and Node surface behavior is authored in first-party TypeScript source packages, not in separate CLR runtime packages:

  • Array methods (push, pop, map, filter, etc.)
  • String methods (toUpperCase, slice, includes, etc.)
  • Math, console, JS-surface JSON, and other global functions

Tsonic.Runtime owns the compiler runtime carriers. It does not define the user-facing @tsonic/js or @tsonic/nodejs API surface. The public JS and Node APIs live in their first-party source packages and compile down to deterministic runtime calls where needed.

Building

dotnet build

Testing

dotnet test

NativeAOT Compatibility

This library is fully compatible with .NET NativeAOT, enabling TypeScript code to be compiled to native executables.

Package

Published as Tsonic.Runtime on NuGet.

License

MIT License - see LICENSE file for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages