Targets · TypeScript · Capabilities
Capabilities
Which high-level features a Program can use when it renders to TypeScript — the same reach as JavaScript, in the browser or on Node, with types checked ahead of time.
Contents
How a Program becomes TypeScript, in parts. Start with the introduction, then follow each part into the rendered output and the runtime it links against.
- Introduction — what the TypeScript target is, and how to read the rest of this section.
- Capabilities — which high-level features are possible, built in or through a library.
- Example — a full program using every keyword, and the TypeScript it renders to.
- Naming considerations — how Program's dotted names are carried into TypeScript.
- Entry point — starting a program and attaching it to a root element.
- Drivers — the native drivers that provide the interface, animation and network.
- Runtime — the Reactive and Context machinery the rendered code links against.
- Native modules — the hand-written JavaScript behind
NATIVEfunctions. - Keywords — how each of Program's keywords renders to TypeScript.
- Project setup — the files and commands to build and run the rendered program.
- Reserved words — the words TypeScript keeps for itself, and how a colliding name is escaped.
Two homes: browser and Node
TypeScript compiles to JavaScript, so a program can run in exactly the same places
— the browser and Node — and reach the same capabilities. What TypeScript adds is not
new reach but compile-time checking: Program's types are carried through, so a
mistake in wiring the interface, a driver, or a native signature is caught by tsc
before the program runs.
| Feature | Status | How |
|---|---|---|
| User interface | Built in (browser) | The DOM interface driver renders Ui; on Node there is no DOM, so a headless or terminal driver is used instead. |
| Networking | Built in | Network uses fetch in the browser and Node alike. |
| Asynchrony | Built in | A LOCKED state models an in-flight value; the driver resolves it and re-enters the cycle. |
| Animation | Built in (browser) | The Animate driver shares one requestAnimationFrame ticker; on the server it has no visible effect. |
| Storage & files | By host | Browser: localStorage/IndexedDB and the file picker. Node: real filesystem access via Storage natives. |
| Types | Built in | Every carried type becomes a TypeScript annotation or generic, so the whole rendered program type-checks. |
| Background threads | Limited | Web Workers (browser) or worker threads (Node) behind a native module; reactive state does not cross the boundary. |
Because the emitted body is the same as JavaScript, any JavaScript library is reachable from a NATIVE function, now with its type declarations honoured.