@tsonic/js
v10.0.48
Published
TypeScript type definitions for JavaScript Runtime (JSRuntime) library
Downloads
1,418
Maintainers
Readme
@tsonic/js
JavaScript runtime bindings for Tsonic.
This package is part of Tsonic: https://tsonic.org.
@tsonic/js provides JS runtime APIs (JSON, console, Map, Set, Date, timers, etc.) for Tsonic projects.
Prerequisites
- Install the .NET 10 SDK: https://dotnet.microsoft.com/download
- Verify:
dotnet --version
Quick Start (surface-first, no @tsonic/js imports required)
mkdir my-app && cd my-app
npx --yes tsonic@latest init --surface @tsonic/jsexport function main(): void {
const value = JSON.parse<{ x: number }>('{"x": 1}');
console.log(JSON.stringify(value));
}Build/run:
npm run devExisting project
npx --yes tsonic@latest add npm @tsonic/jsIf the workspace is not already JS surface, set surface in
tsonic.workspace.json to @tsonic/js:
{
"surface": "@tsonic/js"
}Optional direct imports
Surface mode enables natural JS authoring, but direct package imports remain supported:
import { Timers, JSArray } from "@tsonic/js/index.js";Core APIs
consoleJSONMap,Set,WeakMap,WeakSetDate,Math,RegExp,Number,StringTimersJSArray<T>- globals like
parseInt,parseFloat,encodeURI
Relationship to @tsonic/nodejs
@tsonic/js= JS runtime surface@tsonic/nodejs= Node-style modules (node:fs,node:path,node:crypto, ...)
Versioning
10→versions/10/→ npm:@tsonic/[email protected]
Publish:
npm publish versions/10 --access publicDevelopment
See __build/.
License
MIT
