Answer the question
In order to leave comments, you need to log in
Vue i18n - "Property '$t' does not exist on type 'VueConstructor'" error. How can I fix it?
Using vue i18n in a typescript project.
How to use it correctly in .ts files?
This approach
// for i18n
import Vue from 'vue'
declare module 'vue/types/vue' {
interface VueConstructor {
$t: any
}
}
declare module 'vue/types/options' {
interface ComponentOptions<V extends Vue> {
t?: any
}
}
(()=>{
const test = Vue.$t('auth.title');
console.log( test )
})()
Property '$t' does not exist on type 'VueConstructor<Vue>"
Answer the question
In order to leave comments, you need to log in
$t must be on an instance of the Vue class, not a static property of it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question