Quickstart
VaelJS executes ECMAScript modules (.js, .mjs) and erasable TypeScript (.ts, .mts) directly with no build or bundling step.
1. Run Your First TypeScript Script
Section titled “1. Run Your First TypeScript Script”Create hello.ts using standard erasable TypeScript syntax and canonical vael:* imports:
import { platform, arch } from "vael:os";import { v7 } from "vael:uuid";
interface Greeting { target: string; id: string;}
const msg: Greeting = { target: `${platform}/${arch}`, id: v7(),};
console.log(`Hello from ${Vael.engine} on ${msg.target} (${msg.id})`);Run it on either runtime:
vjs hello.tsvjs-lite hello.ts2. Run Tests with vjs test
Section titled “2. Run Tests with vjs test”Create math.test.ts using vael:test and vael:assert:
import assert from "vael:assert";import test from "vael:test";
function clamp(n: number, min: number, max: number): number { return Math.min(max, Math.max(min, n));}
test("clamp bounds values cleanly", () => { assert.strictEquals(clamp(15, 0, 10), 10); assert.strictEquals(clamp(-3, 0, 10), 0); assert.equals({ ok: true }, { ok: true });});Run one or more files or case-sensitive globs:
vjs test math.test.tsvjs-lite test "*.test.ts"Each selected file executes in a fresh isolated runtime, so module globals and test queues cannot leak across files. There is no default test discovery—you must pass at least one path or glob, and a file that registers zero tests fails with exit code 1.
3. Generate TypeScript Declarations (vjs types)
Section titled “3. Generate TypeScript Declarations (vjs types)”Emit .d.ts files matching your runtime profile for editor autocomplete and tsc --noEmit checks:
# Write the full directory layout for vjs (V8)vjs types --out-dir ./types
# Or emit declarations for vjs-lite (QuickJS)vjs-lite types --out-dir ./types
# Or stream a single-file bundle to stdoutvjs types > vjs.d.tsPoint a minimal tsconfig.json at the generated declarations:
{ "compilerOptions": { "target": "ES2024", "module": "NodeNext", "moduleResolution": "NodeNext", "noEmit": true, "strict": true, "erasableSyntaxOnly": true, "types": ["./types/index.d.ts"] }}4. Add a vael.jsonc Manifest
Section titled “4. Add a vael.jsonc Manifest”Create vael.jsonc in your project root to map clean specifiers or define workspace packages:
{ "name": "@example/app", "version": "0.1.0", "imports": { "@app/config": "./src/config.ts" }}Both vjs and vjs-lite automatically discover vael.jsonc upward from the entry module’s directory. See vael.jsonc & Workspaces for the full schema and rules.
Next Steps
Section titled “Next Steps”- Compare engines in vjs vs vjs-lite.
- Explore all CLI options in Commands & Flags.
- Build a service in Go-Style WebApps or automate tasks in Automation Recipes.
