I have a Vue mixin that looks like this:
const languageMixin = Vue.extend({
methods: {
$getLanguages: function(): object {
return {
en: 'english'
}
}
}
}
Vue.mixin(languageMixin)
new Vue({
router,
render: h => h(Frame)
}).$mount('#app')
... and I'm attempting to utilize it in a component:
<template lang="pug">
.languages
a( v-for="language, code in $getLanguages()" :key="code" @click="$root.$i18n.locale = code") {{ language }}
</template>
<script lang="ts">
import Vue from 'vue'
export default Vue.extend({
methods: {
languagesList: function () {
console.log(this.$getLanguages)
}
}
})
</script>
However, I encounter an error message that reads "Property '$getLanguages' does not exist on type 'CombinedVueInstance
Interestingly, the function works when used in the template as the language names are displayed. It's just the TypeScript code that does not recognize the function.