Guide

TypeScript

Nitro automatically generates the types for auto-imports and server routes ✨

tsconfig.json

To leverage type hints within your project, create a tsconfig.json file that extends auto-generated types.

{
  "extends": "./.nitro/types/tsconfig.json"
}
Starter templates have this file by default and usually you don't need to do anything. If this file does not exists, you can manually create it.

Prepare types

You can use prepare command to auto generate the types. This can be useful in a CI environment or as a postinstall command in your package.json.

npx nitro prepare
When using nitro dev command, types are also auto-generated!
For Nuxt you should use nuxi generate