TypeScript
Get intellisense for editors and AI agents for $x, $route, and Manifest's other magic globals without adding a build step.
Overview
The optional mnfst-types CLI generates a single manifest.d.ts in the project root that declares the framework's globals and adds project-specific types for every data source registered in manifest.json — inferred from the actual CSV / JSON / YAML files or integrated Appwrite database configuration. Project files stay .js and .html — VS Code, Cursor, and AI tooling pick the declarations up automatically.
Run from the project root (next to manifest.json):
npx mnfst-types
Re-run whenever a data source is added or its shape changes.
CLI Options
| Option | Description | Default |
|---|---|---|
--manifest <path> |
Path to manifest.json |
./manifest.json |
--out <path> |
Output .d.ts path |
./manifest.d.ts |
--init |
Also write a baseline jsconfig.json (only if missing) |
— |
--tsc |
Type-check the scripts the page loads instead of writing manifest.d.ts (see type checks) |
— |
--check |
Exit 1 if manifest.d.ts is out of date; write nothing |
— |
--ci |
Also write .github/workflows/types.yml (only if missing) |
— |
-h, --help |
Show usage | — |
--init is for projects that want JSDoc errors surfaced as squiggles in .js files. Without it, the declarations still power autocomplete and inline type info.
Type Checks
To find mistakes before anyone clicks, run the TypeScript checker over your scripts. Nothing is compiled; your files stay as they are.
npx mnfst-types --tsc
Run npx mnfst-types first, since --tsc reads manifest.d.ts but doesn't write it. It checks the local scripts your index.html and component files load, everything they import, and the project's .d.ts files. Import-map paths are read on every run. A jsconfig.json or tsconfig.json of your own is extended, and its include or files win.
cart.js(1,10): error TS2724: '"./money.js"' has no exported member named 'formatPrise'. Did you mean 'formatPrice'?
Inside a component, the checker doesn't know what this is. A one-line helper of your own tells it, so fields of $x rows and stores are checked too. Call it whatever you like. Here products is a local JSON source, so its fields are known:
typed.js /**
* @template T
* @param {(...args: any[]) => import('mnfst').ManifestComponent<T>} factory
* @returns {(...args: any[]) => T}
*/
export const typed = (factory) => factory
shelf.js import { typed } from './typed.js'
export const shelf = typed(() => ({
get first() { return this.$x.products[0].nmae } // Property 'nmae' does not exist
}))
Appwrite rows accept any field until you describe them by augmenting ManifestRows (and stores with ManifestStores) in a .d.ts file:
types.d.ts declare module 'mnfst' {
interface ManifestRows { tasks: { title: string, done: boolean } }
}
export {}
npx mnfst-types --ci adds a GitHub workflow that runs --check and --tsc on every push.
Autocomplete
For autocomplete and validation in manifest.json itself, add a $schema reference at the top of the file. The starter project includes this line by default:
manifest.json {
"$schema": "https://manifestx.dev/manifest.schema.json",
"name": "My Project",
"data": { ... }
}
VS Code and most JSON-aware editors fetch and apply the schema automatically.
Regeneration
The generated manifest.d.ts has a static portion (magic globals, source-state operators, base types — same for every project) and a project augmentation block bracketed by // AUGMENTATION:start and // AUGMENTATION:end. Re-running the CLI overwrites the augmentation block; the static portion is also refreshed so it stays in sync with the installed framework version.
Article does not exist
There is no documentation at this path.