Configuration
Add an nuxtTypedRouter
section in your nuxt.config
:
nuxt.config.ts
export default defineNuxtConfig({
modules: [
['nuxt-typed-router', {
// options
}]
],
})
Available options:
export interface ModuleOptions {
/**
*
* Enables path autocomplete and path validity for programmatic validation
*
* @default true
*/
pathCheck?: boolean;
/**
* Set to false if you don't want a plugin generated
* @default false
*/
plugin?: boolean;
/**
* Customise Route location arguments strictness for `NuxtLink` or `router`
* All strict options are disabled by default.
* You can tweak options to add strict router navigation options.
*
* By passing `true` you can enable all of them
*
* @default false
*/
strict?: boolean | StrictOptions;
/**
* Remove Nuxt definitions to avoid conflicts
* @default true
*/
experimentalRemoveNuxtDefs?: boolean;
}
See How it works for documentation on how to use the typed router.
If you disabled auto-imports, you can see the usage without auto-imports