fix(schema): fix RouterConfig types (#3964)

This commit is contained in:
pooya parsa 2022-03-30 10:17:46 +02:00 committed by GitHub
parent c28c6a8c8a
commit 7e6c4e2d5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 5 deletions

View File

@ -274,10 +274,10 @@ It is possible to set default [vue-router options](https://router.vuejs.org/api/
This is the recommaned way to specify router options.
```js [app/router.options.ts]
import type { RouterOptions } from '@nuxt/schema'
import type { RouterConfig } from '@nuxt/schema'
// https://router.vuejs.org/api/#routeroptions
export default <RouterOptions>{
export default <RouterConfig>{
}
```

View File

@ -9,7 +9,7 @@ export default {
* For more control, you can use `app/router.optionts.ts` file.
*
* @see [documentation](https://router.vuejs.org/api/#routeroptions)
* @type {import('../src/types/router').RouterConfigOptions}
* @type {import('../src/types/router').RouterConfigSerializable}
*
* @version 3
*/

View File

@ -1,9 +1,16 @@
import type { RouterOptions as _RouterOptions } from 'vue-router'
export type RouterOptions = Exclude<_RouterOptions, 'history' | 'routes'>
export type RouterConfig = Partial<Omit<_RouterOptions, 'history' | 'routes'>>
/** @deprecated Use RouterConfig instead */
export type RouterOptions = RouterConfig
/**
* Only JSON serializable router options are configurable from nuxt config
*/
export type RouterConfigOptions = Pick<RouterOptions, 'linkActiveClass' | 'linkExactActiveClass' | 'end' | 'sensitive' | 'strict'>
export type RouterConfigSerializable = Pick<RouterConfig, 'linkActiveClass' | 'linkExactActiveClass' | 'end' | 'sensitive' | 'strict'>
/** @deprecated Use RouterConfigSerializable instead */
export type RouterConfigOptions = RouterConfigSerializable