Skip to content
edge-language-tools
Esc
navigateopen⌘Jpreview
On this page

Getting started

Install the tooling and get your first squiggle.

Check templates from the terminal

Clone and install

git clone https://github.com/eduwass/edge-language-tools
cd edge-language-tools
npm install
git clone https://github.com/eduwass/edge-language-tools
cd edge-language-tools
pnpm install
git clone https://github.com/eduwass/edge-language-tools
cd edge-language-tools
yarn install
git clone https://github.com/eduwass/edge-language-tools
cd edge-language-tools
bun install

Link the CLIs into your project

Register the packages from the clone:

cd packages/check && npm link
cd ../codegen && npm link
cd packages/check && pnpm link --global
cd ../codegen && pnpm link --global
cd packages/check && yarn link
cd ../codegen && yarn link
cd packages/check && bun link
cd ../codegen && bun link

Then, in your own project:

npm link @edge-language-tools/check
npm link @edge-language-tools/codegen
pnpm link --global @edge-language-tools/check
pnpm link --global @edge-language-tools/codegen
yarn link @edge-language-tools/check
yarn link @edge-language-tools/codegen
bun link @edge-language-tools/check
bun link @edge-language-tools/codegen

No project of your own yet? Skip linking — you can run the checker directly from the clone with node packages/check/src/cli.ts /path/to/templates (or the same with bun).

Declare a template's types

{{--
@types {
  user: { displayName: string, bio: string }
}
--}}
<h2>{{ user.displayName }}</h2>

Run the check

npx edge-check templates/
pnpm exec edge-check templates/
yarn edge-check templates/
bunx edge-check templates/
templates/profile.edge:9:56 - error TS2551: Property 'displayNaem' does not
exist on type '{ displayName: string; bio: string; }'. Did you mean 'displayName'?

1 error across 4 checked templates (1 unchecked, 5 total)

Exit code is 1 when errors exist — wire it into CI. --format json emits machine-readable diagnostics.

Typed render calls

Generate a registry of every template’s declared props:

npx edge-codegen templates/ --out edge-templates.d.ts
pnpm exec edge-codegen templates/ --out edge-templates.d.ts
yarn edge-codegen templates/ --out edge-templates.d.ts
bunx edge-codegen templates/ --out edge-templates.d.ts

Then cast once at setup:

import { Edge } from 'edge.js'
import type { TypedEdge } from './edge-templates.d.ts'

const edge = Edge.create() as unknown as TypedEdge
await edge.render('profile', { user })   // wrong props = compile error

Run with --watch to regenerate as templates change. Templates without a @types block stay callable with any props.

Editors

See Editor setup for VS Code, Cursor, and Zed.

Was this page helpful?