Skip to main content
The Vertz compiler is a build plugin that transforms your code at compile time. It turns idiomatic TypeScript into fine-grained reactive DOM operations — so you write simple code and get optimal performance.

What it does

The compiler transforms three things:

1. let → signals

Every let declaration becomes a signal. Reads become .value accesses, and assignments become .value = writes:

2. const → computed

When a const depends on reactive values, the compiler wraps it in computed():
The compiler analyzes dependencies automatically — you don’t need to declare them.

3. JSX → fine-grained DOM

JSX is compiled into direct DOM creation with reactive bindings:
This is simplified — the actual output handles fragments, components, event delegation, and more. But the principle is the same: no virtual DOM, no diffing, direct DOM mutations.

4. AOT SSR compilation

For server-side rendering, the compiler can generate string-builder functions that bypass the DOM shim entirely:
The compiler classifies each component by complexity (static, data-driven, conditional, or runtime-fallback) and generates optimized string functions for the first three tiers. Components that use hooks or effects fall back to the standard DOM shim at render time. See SSR — AOT-compiled SSR for details.

What it doesn’t do

The compiler is per-file, single-pass. It does not:
  • Analyze across files — each file is compiled independently
  • Run type checking — that’s still tsc
  • Bundle modules — that’s the bundler (esbuild/V8)
  • Optimize at runtime — all transforms happen at build time

Reactive prop generation

When you pass expressions to a component, the compiler generates getter-based props so reactivity flows through:
The child component reads task and disabled as plain values. The getters re-evaluate whenever the underlying signals change — updating only the affected DOM nodes, not the entire component.

Destructured props

You write idiomatic destructured parameters — the compiler reverses them to preserve getter-based reactivity:
This works with aliases ({ id: cardId }), defaults ({ size = 'md' }), and rest patterns ({ title, ...rest }). You never need to think about it — write destructured props as usual and the compiler handles the rest.

Signal API awareness

The compiler knows which APIs return objects with signal properties. For example, query() returns an object where .data, .loading, and .error are signals:
This registry includes query(), form(), and other framework APIs.

How to use it

The compiler runs automatically when you use the Vertz dev server or build command:
The compiler is integrated into the vtz runtime and runs automatically during vtz dev and vtz build. No manual plugin setup is required.

TypeScript configuration

The compiler requires these tsconfig.json settings:
This tells TypeScript to use the Vertz JSX factory, which maps HTML tags to their specific DOM element types (<form>HTMLFormElement, <input>HTMLInputElement).