TypeScript language runtime primitives for Tsonic compiler - provides Union types, structural typing, and other TS language features in C#
$ dotnet add package Tsonic.RuntimeTypeScript language runtime primitives for the Tsonic compiler - provides Union types, structural typing, and other TypeScript language features in C#.
Tsonic.Runtime contains mode-independent TypeScript language primitives that are used in all Tsonic compilation modes. This library provides:
Union<T1, T2, ...> for TypeScript unions like string | numberStructural.Clone<T>() and DictionaryAdapter<T> for duck typingDynamicObject for TypeScript's keyof and indexed access patternstypeof and instanceof operator supportThis library is referenced by all Tsonic projects, regardless of mode:
mode = "dotnet" (default) - Uses only Tsonic.Runtimemode = "js" - Uses both Tsonic.Runtime and Tsonic.JSRuntimeJavaScript built-in semantics are in a separate package (Tsonic.JSRuntime):
dotnet build
dotnet test
This library is fully compatible with .NET NativeAOT, enabling TypeScript code to be compiled to native executables.
Published as Tsonic.Runtime on NuGet.
MIT License - see LICENSE file for details.