Getting Started
Use the JS surface when you want ambient JavaScript-style authoring.
tsonic init --surface @tsonic/js
export function main(): void {
console.log("hello".toUpperCase());
}
Then build or run normally:
tsonic run
What init --surface @tsonic/js configures
It sets the workspace surface and bootstraps the required type roots so the ambient JS world is available immediately.
In practice that means:
- the workspace selects
surface: "@tsonic/js" @tsonic/jsis installed if needed- the starter project is still authored as a normal source package
Existing workspace
If you already have a workspace and want to switch it:
tsonic add npm @tsonic/js
Then set:
{
"surface": "@tsonic/js"
}
in tsonic.workspace.json.
Ambient API families
consoleJSONDateMap,Set- typed arrays
- receiver-style string and array methods
- timers
You usually do not import those directly; the surface makes them ambient.
When to add more packages
- add
@tsonic/nodejswhen you want Node-style modules - add
@tsonic/expresswhen you want Express-style routing