Language Overview
Pure compiles TypeScript and JavaScript to native machine code. It is not a wrapper around Node, Bun, or any other JavaScript engine. The output is a standalone binary that runs your program directly — no VM, no interpreter, no JIT compilation at startup.
Mental model
Section titled “Mental model”Think of Pure the same way you think of a Go or Rust compiler: you write source code, run a compiler, get a binary. That binary embeds the logic of your program. It does not bundle a JavaScript runtime.
This has a few practical consequences:
- Cold start is deterministic and fast. There is no module resolution, no JIT warm-up, no
require()cache. The binary starts in milliseconds. evalandFunction()do not work. Code generation at runtime requires a JavaScript engine, which is not present. See Not supported.require()resolution is fixed at compile time. Dynamicrequire()with variable paths is not supported.- Standard library surface differs from Node. Pure implements the most common Node built-ins, but not all of them. See Node compatibility.
TypeScript support
Section titled “TypeScript support”Pure supports TypeScript 5.x syntax. Type annotations are stripped; no type-checking is performed by Pure itself (run tsc --noEmit or use your editor’s type checker for that). The following TypeScript features work:
- Type annotations and interfaces
- Generics
- Enums (const and regular)
- Decorators (experimental)
satisfies,as const,!(non-null assertion)- Optional chaining (
?.) and nullish coalescing (??) - Module augmentation
JavaScript version
Section titled “JavaScript version”Pure targets ES2022 and later. The following language features are supported:
async/awaitandPromise- Generators and async generators
- Classes with private fields (
#field) - Top-level
await import/export(ESM)structuredClone,WeakRef,FinalizationRegistryArray.at(),Object.hasOwn(),String.replaceAll(),Array.findLast(), and other ES2021–ES2023 additions
CommonJS (require()) is also supported for compatibility.
Sections
Section titled “Sections”- Supported features — detailed list of supported syntax and APIs
- Node compatibility — built-in modules and per-module caveats
- Not supported — explicit list of what does not work
- OS support — platform targets, glibc requirements, binary characteristics