
Provide a type safe router to Nuxt with auto-generated typed definitions for route names and autocompletion for route params
NuxtLink
route autocomplete and params type-checkuseRouter
, useRoute
and navigateTo
route autocomplete and params type-check- Supports optional params and catchAll routes
- Out of the box
i18n
support - Supports routes extended by config and modules
⚠️ Since v2.1.x
, useTypedRouter
and useTypedRoute
are no longer exported.
The package can now override types from useRouter
, useRoute
and navigateTo
Documentation

Play with it

Demo repo 🧪 : nuxt-typed-router-demo
Compatibility:
Quick start
For Nuxt 3
yarn add -D nuxt-typed-router
npm install -D nuxt-typed-router
pnpm install -D nuxt-typed-router
Nuxt 2 legacy
Nuxt 2 version is no longer maintained, but still available in nuxt2
branch
It only has route name autocomplete functionnality
yarn add -D nuxt-typed-router@legacy
npm install -D nuxt-typed-router@legacy
Configuration
Register the module in the nuxt.config.ts
, done!
export default defineNuxtConfig({
modules: ['nuxt-typed-router'],
});
Roadmap
Development
- Clone this repository
- Install dependencies using
pnpm
- Build project for local tests
pnpm run test
- Start dev playground
pnpm run prepack && pnpm run dev
- Build project for deploy
pnpm prepack
📑 License
MIT License