Skip to main content
Aero supports TypeScript in <script is:build> blocks, content config files, and shared type modules. The VS Code extension provides IntelliSense and diagnostics automatically. You can type component props, validate content schemas, and run aero check --types in CI.

Ambient types

Aero ships ambient declarations that make Aero, renderComponent, and *.html imports available to TypeScript. Include them in your tsconfig.json:
tsconfig.json
Or use a triple-slash reference:
For .html build scripts, the VS Code extension injects these declarations automatically. You only need the above for .ts files outside of templates.

Typing component props

Aero.props is typed as Record<string, any> by default. Add type safety with an interface:
client/components/greeting.html
For shared types, define them in a .ts file and import:
client/types/props.ts
client/components/header.html
When you use as TypeName, required vs optional comes from the interface (name vs name?). Without a cast, Aero infers required props from destructuring defaults: no default means required at the call site; a default means optional.
Here title is required and body is optional for aero check and IDE diagnostics.

Typing content collections

Use a schema validator in content.config.ts to type collection entries:
content.config.ts

Typing import.meta.env

Create an env.d.ts to add types for environment variables:
env.d.ts

CI type-checking

Run type checks in CI without an IDE:
This runs compile checks, then TypeScript on build scripts and { } interpolation sites. See CLI for flags and exit codes.