morteza mortezaie
morteza mortezaie

Reputation: 1564

Typescript & nuxt : i18n types doesn't work

i am using nuxtjs/i18n in typescript and i've added its types in TS config :

{
  "compilerOptions": {
    "types": [
      "@nuxt/types",
      "@nuxtjs/i18n",
    ]
  }
}

But in componnets when i want to use

this.$i18n.locales

i have this error

enter image description here

enter image description here

so , How can I fix types error for @nuxt/i18n ?

Upvotes: 0

Views: 1310

Answers (1)

anotherOneHere
anotherOneHere

Reputation: 69

Try something like this:

import { LocaleObject } from '@nuxtjs/i18n'
...
(this.$i18n.locales as LocaleObject[])

Upvotes: 1

Related Questions