From cb0808ae53941fc95c2dbfbb774a307320fa3bed Mon Sep 17 00:00:00 2001 From: Victor Garcia Date: Mon, 4 Dec 2023 14:12:00 +0100 Subject: [PATCH] fix: useLocalePath has no type access to route #130 --- playground/nuxt.config.ts | 2 +- src/core/output/generators/files/__i18n-router.file.ts | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/playground/nuxt.config.ts b/playground/nuxt.config.ts index 76454d1..5f38e4a 100644 --- a/playground/nuxt.config.ts +++ b/playground/nuxt.config.ts @@ -15,7 +15,7 @@ export default defineNuxtConfig({ }, srcDir: './src', i18n: { - // defaultLocale: 'de', + defaultLocale: 'de', // dynamicRouteParams: true, locales: [ { diff --git a/src/core/output/generators/files/__i18n-router.file.ts b/src/core/output/generators/files/__i18n-router.file.ts index 83951fc..27328a4 100644 --- a/src/core/output/generators/files/__i18n-router.file.ts +++ b/src/core/output/generators/files/__i18n-router.file.ts @@ -11,6 +11,7 @@ export function createi18nRouterFile() { return /* typescript */ ` import type { RouteLocationRaw } from 'vue-router'; import { useLocalePath as _useLocalePath, useLocaleRoute as _useLocaleRoute} from 'vue-i18n-routing'; + import type {I18nCommonRoutingOptionsWithComposable} from 'vue-i18n-routing'; import type {TypedRouteLocationRawFromName, TypedLocationAsRelativeRaw, TypedRouteFromName} from './__router'; import type {RoutesNamesList} from './__routes'; ${returnIfTrue( @@ -48,7 +49,7 @@ export function createi18nRouterFile() { )} } - export function useLocalePath(options?: Pick[0]>, 'i18n'>): TypedToLocalePath { + export function useLocalePath(options?: I18nCommonRoutingOptionsWithComposable): TypedToLocalePath { return _useLocalePath(options) as any; } @@ -61,7 +62,7 @@ export function createi18nRouterFile() { } - export function useLocaleRoute(options?: Pick[0]>, 'i18n'>): TypedLocaleRoute { + export function useLocaleRoute(options?: I18nCommonRoutingOptionsWithComposable): TypedLocaleRoute { return _useLocaleRoute(options) as any; }