From 3a42a7bc2518d7645f684b729f92ae8fb6beb6d5 Mon Sep 17 00:00:00 2001 From: Typed SIGTERM Date: Tue, 13 Aug 2024 21:15:46 +0800 Subject: [PATCH] docs: improve typing of default exports (#28520) --- docs/2.guide/4.recipes/1.custom-routing.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/2.guide/4.recipes/1.custom-routing.md b/docs/2.guide/4.recipes/1.custom-routing.md index 35685305de..7b1b24e321 100644 --- a/docs/2.guide/4.recipes/1.custom-routing.md +++ b/docs/2.guide/4.recipes/1.custom-routing.md @@ -16,7 +16,7 @@ If it returns `null` or `undefined`, Nuxt will fall back to the default routes ( ```ts [app/router.options.ts] import type { RouterConfig } from '@nuxt/schema' -export default { +export default { // https://router.vuejs.org/api/interfaces/routeroptions.html#routes routes: (_routes) => [ { @@ -25,7 +25,7 @@ export default { component: () => import('~/pages/home.vue').then(r => r.default || r) } ], -} +} satisfies RouterConfig ``` ::note @@ -90,8 +90,8 @@ This is the recommended way to specify [router options](/docs/api/nuxt-config#ro ```ts [app/router.options.ts] import type { RouterConfig } from '@nuxt/schema' -export default { -} +export default { +} satisfies RouterConfig ``` It is possible to add more router options files by adding files within the `pages:routerOptions` hook. Later items in the array override earlier ones. @@ -174,8 +174,8 @@ You can optionally override history mode using a function that accepts the base import type { RouterConfig } from '@nuxt/schema' import { createMemoryHistory } from 'vue-router' -export default { +export default { // https://router.vuejs.org/api/interfaces/routeroptions.html history: base => import.meta.client ? createMemoryHistory(base) : null /* default */ -} +} satisfies RouterConfig ```