How can i describe global virtual methods like $t for i18n? I didn't see insgructions in the documentation. You don't have the feature or I can't find solution?
I use only JsDoc and simple JS. Without typescript

Error: Property '$t' does not exist on type 'CombinedVueInstance<{ openedSubMenuId: any; } & { openSub(id: any): void; closeSub(): void; } & { nav: NavItem[]; value: boolean; } & Vue, object, object, object, Record

You fix this the same way as with any other package that provides types. You add the package name to the types array in tsconfig.json.
{
"compilerOptions": {
// ...
"types": [
"vue-i18n",
],
},
}
You fix this the same way as with any other package that provides types. You add the package name to the
typesarray intsconfig.json.{ "compilerOptions": { // ... "types": [ "vue-i18n", ], }, }
I forgot to say. I don't use typescript. I setup types by JsDoc

The same answer applies.
The same answer applies.
It doesn't work.
And I have to add empty ts file to avoid this error in tsconfig

Why would it be empty if I told you to add this to fix it: https://github.com/vuejs/vetur/issues/2502#issuecomment-735225830
?
Why would it be empty if I told you to add this to fix it: #2502 (comment)
?
You told me add tsconfig. I did it. Read my comment closely. "I have to add empty ts file to avoid this error in tsconfig" - wihout any ts file in the project I have the problem in the tsconfig
Well, you should also have the usual boilerplate. Not only the extra part that I've written before. For example something like:
{
"compilerOptions": {
"baseUrl": ".",
"target": "esnext",
"module": "esnext",
"moduleResolution": "node",
"esModuleInterop": true,
"allowJs": true,
"checkJs": true,
"allowSyntheticDefaultImports": true,
"lib": ["dom", "esnext"],
"noEmit": true,
"resolveJsonModule": true,
"strict": true,
"types": [
"vue-i18n",
],
},
}
And if you have further problems then create a repro as we can't be guessing your problem from vague comments forever.
Well, you should also have the usual boilerplate. Not only the extra part that I've written before. For example something like:
{ "compilerOptions": { "baseUrl": ".", "target": "esnext", "module": "esnext", "moduleResolution": "node", "esModuleInterop": true, "allowJs": true, "checkJs": true, "allowSyntheticDefaultImports": true, "lib": ["dom", "esnext"], "noEmit": true, "resolveJsonModule": true, "strict": true, "types": [ "vue-i18n", ], }, }And if you have further problems then create a repro as we can't be guessing your problem from vague comments forever.
Thank you! It's my fault. I use nuxt and I need add this types
{
"compilerOptions": {
"types": ["@nuxt/types", "nuxt-i18n"]
}
}
Yes. And it's explained in the docs also: https://i18n.nuxtjs.org/setup#typescript :)
(nuxt-i18n maintainer here ;))
Most helpful comment
Yes. And it's explained in the docs also: https://i18n.nuxtjs.org/setup#typescript :)
(
nuxt-i18nmaintainer here ;))