Skip to content

Commit

Permalink
fix(types): extend NuxtOptions with "i18n" (when using i18n in the ro…
Browse files Browse the repository at this point in the history
…ot of Nuxt config)

Also add missing "defaultLocaleRouteNameSuffix" option to types.
  • Loading branch information
rchl committed Jul 1, 2020
1 parent f1a7230 commit 7c5241b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion types/nuxt-i18n.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Context as NuxtContext } from '@nuxt/types'
*/
declare namespace NuxtVueI18n {
type Locale = VueI18n.Locale
type Strategies = 'no_prefix' | 'prefix_except_default' | 'prefix' | 'prefix_and_default'

namespace Options {
// e.g.:
Expand Down Expand Up @@ -50,6 +51,7 @@ declare namespace NuxtVueI18n {
interface NuxtI18nInterface {
beforeLanguageSwitch?: (oldLocale: string, newLocale: string) => void
defaultLocale?: Locale
defaultLocaleRouteNameSuffix?: string
locales?: Array<Locale | LocaleObject>
differentDomains?: boolean
forwardedHost?: boolean
Expand All @@ -72,7 +74,7 @@ declare namespace NuxtVueI18n {
rootRedirect?: string | null | RootRedirectInterface
routesNameSeparator?: string
seo?: boolean
strategy?: 'no_prefix' | 'prefix_except_default' | 'prefix' | 'prefix_and_default'
strategy?: Strategies
vueI18n?: VueI18n.I18nOptions | string
vueI18nLoader?: boolean
vuex?: VuexInterface | false
Expand Down
4 changes: 4 additions & 0 deletions types/vue.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ declare module '@nuxt/types' {
interface NuxtAppOptions extends NuxtVueI18n.Options.NuxtI18nInterface {
readonly i18n: VueI18n & IVueI18n
}

interface NuxtOptions {
i18n?: NuxtVueI18n.Options.AllOptionsInterface
}
}

declare module 'vuex/types/index' {
Expand Down

0 comments on commit 7c5241b

Please sign in to comment.