Skip to content

Introduction

Nola is a TypeScript superset. Files end in .tsi, and everything you know about TypeScript applies inside them — plus two constructs that make talking to a language model part of the language rather than a library call. The Nola toolchain lowers .tsi to plain TypeScript before tsc, bundlers, Node, or your editor ever see it, the same way JSX is compiled away.

person.tsi
export interface Person { name: string; age: number; employer: string }
export infer function extractPerson(.message: string) {
return ask ..`the person described in the text`<Person>;
}
// main.ts — plain TypeScript imports the .tsi directly
import { extractPerson } from "./person.tsi";
const person = await extractPerson("Alice Smith, 32, is a staff engineer at Acme Corp.");
console.log(person); // { name: "Alice Smith", age: 32, employer: "Acme Corp" }
  • infer function declares an LLM-backed function. It lowers to an ordinary function that returns a lazy, thenable Intent<T>; awaiting the result runs the inference. Parameters that start with a dot (.message) are context: their values are shown to the model. Plain parameters are ordinary values the model never sees. One dot in, two dots out.
  • ask resolves an intent the way await resolves a promise. ask ..`prompt`<T> is an extractor — ask the model for a T. ask fn`hint`(...) is a call intent — the model fills the extractor-shaped arguments and the function runs. ask with <provider> … routes one ask through a named provider from nola.config.ts.
Piece Package
CLI — nola init / build / run / check and the Node loader (node --import nola-lang/register) nola-lang
Runtime — Intent<T>, defineConfig @nola-lang/runtime
Providers — openai, anthropic, google, mockProvider, withRetry, fallback, roundRobin, record/replay @nola-lang/providers
Scaffolder create-nola-lang (alias create-nola)
Bundler plugins — Vite, webpack, Rollup, Rolldown, esbuild, Rspack, Next.js @nola-lang/vite, @nola-lang/webpack, …
Editor — tsserver plugin, language server, VS Code extension nola.nola-vscode

Diagnostics are numbered NOLA1xxx (parse), NOLA2xxx (compile), NOLA3xxx (runtime) and NOLA4xxx (bundler).

Next: Getting started — scaffold a project and run your first .tsi file.