Run typescript in the browser
Type-check and compile TypeScript with the real tsc.
Try it live
Nothing is downloaded until you press Run.
Type-check a file with tsc on the host Node engine
Installs the TypeScript tree from the signed catalog and runs tsc with node …, which the SDK shell sends to the host JavaScript engine — fast, no 26 MB RISC-V node download.
node /usr/local/lib/node_modules/typescript/lib/tsc.js --version node /usr/local/lib/node_modules/typescript/lib/tsc.js --strict --noEmit /work/app.ts
$ node /usr/local/lib/node_modules/typescript/lib/tsc.js --version Version 5.9.3 $ node /usr/local/lib/node_modules/typescript/lib/tsc.js --strict --noEmit /work/app.ts app.ts(1,7): error TS2322: Type 'string' is not assignable to type 'number'. [exit 2]
What it is
The catalog package is the unmodified TypeScript 5.9 npm tree (installed under /usr/local/lib/node_modules) and its tsc compiler; it needs a Node.js runtime. In the browser it type-checks code a visitor writes and emits JavaScript with the same diagnostics as a local build.
Package facts
- version
5.9.3- runs on
- RISC-V VM (
elf-app,riscv64gc-linux-musl) - download
- 4.4 MB compressed · 133 files
- command
tsc- requires
- node
- license
Apache-2.0(upstream)- upstream
- github.com/microsoft/TypeScript
- collections
- Node dev toolchain
- catalog
- generation 12, Ed25519-signed
Install and run it from your page
With the SDK, installApp resolves typescript in the signed index, fetches its content-addressed chunks from the CDN, verifies each one and writes the files into the VM. It is a JavaScript program, so it needs a Node.js runtime: install the catalog's node and run it on the RISC-V VM, or run its entry script with nano.node() on the host JavaScript engine where that engine supports it. Details in Installing catalog apps.
import { createNano } from "@userland-run/nano-sdk";
const nano = await createNano({
image: { wasm: "/nano/console.wasm" },
ramMB: 512,
engines: { node: "host" }, // nano.node() runs on the host JS engine
});
await nano.installApp("typescript"); // signature-verified, cached in OPFS
const r = await nano.node(["/usr/local/lib/node_modules/typescript/lib/tsc.js","--version"]);
console.log(r.stdout);Typical usage of the upstream command-line tool:
tsc --noEmit -p tsconfig.json
Caveats
- node — needs a Node.js runtime. Node on the RISC-V VM boots a 1.8 GB guest and is slow to start; the host engine is fast but not the same binary. See limitations.
Related apps
- node25.4.0Node.js 25 compiled for RISC-V and run on NanoVM's emulator — the full runtime, not a shim.RISC-V VM26 MB
- eslint10.0.0Find and fix problems in JavaScript code with the real ESLint and your own rules.RISC-V VMneeds node2.4 MB
- prettier3.8.1Format JavaScript, TypeScript, CSS, JSON, Markdown and more with the real Prettier.RISC-V VMneeds node2.2 MB