typed-router
typed-router
Provide autocompletion for pages route names and params
Provide a type safe router to Nuxt
- Supports all programmatic navigation utils (
NuxtLink
,useRouter
,navigateTo
,useRoute
,useLocalePath
, etc...) - Supports optional params and catchAll routes
- Autocompletes routes paths, names and params
- Throw error if route path is invalid
- Out of the box
i18n
support - Supports routes extended by config and modules
Documentation
Play with it
Demo repo 🧪 : nuxt-typed-router-demo
Cool video about it from LearnVue!
Compatibility:
- Nuxt 3
Quick start
For Nuxt 3
yarn add -D nuxt-typed-router
# or
npm install -D nuxt-typed-router
# or
pnpm install -D nuxt-typed-router
Configuration
Register the module in the nuxt.config.ts
, done!
export default defineNuxtConfig({
modules: ['nuxt-typed-router'],
});
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