From da6a523c95b68854b846f3c7d739a8c85b0785f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Ch=C5=82odnicki?= Date: Fri, 20 Sep 2019 12:10:15 +0200 Subject: [PATCH] fix(types): specify arguments for onLanguageSwitched and beforeLanguageSwitch --- docs/options-reference.md | 8 +++++--- types/nuxt-i18n.d.ts | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/options-reference.md b/docs/options-reference.md index 9f4ad0741..c92788ed9 100644 --- a/docs/options-reference.md +++ b/docs/options-reference.md @@ -85,7 +85,9 @@ Here are all the options available when configuring the module and their default // https://nuxt-community.github.io/nuxt-i18n/seo.html#improving-performance seo: false, - // Base URL to use as prefix for alternate URLs in hreflang tags + // Fallback base URL to use as prefix for alternate URLs in hreflang tags. + // By default VueRouter's base URL will be used and only if that is not available, + // fallback URL will be used. baseUrl: '', // By default a store module is registered and kept in sync with the @@ -120,9 +122,9 @@ Here are all the options available when configuring the module and their default encodePaths: true, // Called right before app's locale changes - beforeLanguageSwitch: () => null, + beforeLanguageSwitch: (oldLocale, newLocale) => null, // Called after app's locale has changed - onLanguageSwitched: () => null + onLanguageSwitched: (oldLocale, newLocale) => null } ``` diff --git a/types/nuxt-i18n.d.ts b/types/nuxt-i18n.d.ts index f73cb382d..70d625faf 100644 --- a/types/nuxt-i18n.d.ts +++ b/types/nuxt-i18n.d.ts @@ -40,12 +40,12 @@ declare namespace NuxtVueI18n { // options that are also exposed on VueI18n instance: https://goo.gl/UwNfZo interface NuxtI18nInterface { - beforeLanguageSwitch?: () => any + beforeLanguageSwitch?: (oldLocale: string, newLocale: string) => void defaultLocale?: null | Locale locales?: Array differentDomains?: boolean forwardedHost?: boolean - onLanguageSwitched?: () => any + onLanguageSwitched?: (oldLocale: string, newLocale: string) => void } // see options reference: https://github.com/nuxt-community/nuxt-i18n/blob/master/docs/options-reference.md