Skip to content

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.

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.
  • eval and Function() 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. Dynamic require() 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.

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

Pure targets ES2022 and later. The following language features are supported:

  • async/await and Promise
  • Generators and async generators
  • Classes with private fields (#field)
  • Top-level await
  • import/export (ESM)
  • structuredClone, WeakRef, FinalizationRegistry
  • Array.at(), Object.hasOwn(), String.replaceAll(), Array.findLast(), and other ES2021–ES2023 additions

CommonJS (require()) is also supported for compatibility.