Language Intrinsics
Tsonic language intrinsics live in @tsonic/core/lang.js.
Common intrinsics
import {
asinterface,
defaultof,
nameof,
out,
sizeof,
stackalloc,
trycast,
} from "@tsonic/core/lang.js";
Why they exist
These intrinsics expose CLR/lowering-aware operations that TypeScript itself does not model directly.
Examples:
nameoffor CLR-friendly name extractionsizeoffor deterministic size queriesstackallocandoutfor CLR interop casesasinterfaceandtrycastfor explicit interface/cast intent
Typical usage categories
Name and shape helpers
nameofsizeofdefaultof
CLR interop helpers
outstackallocasinterfacetrycast
Attribute and overload metadata
The same module also carries language-facing marker DSL pieces used in CLR-heavy codebases for attributes and overload families.