I have a Vue mixin like so:
const mixin = Vue.extend({
methods: {
$languages: function(): object {
return {
en: 'english'
}
}
}
}
Vue.mixin(mixin)
new Vue({
router,
render: h => h(Frame)
}).$mount('#app')
... and I'm trying to use it in a component:
<template lang="pug">
.languages
a( v-for="language, code in $languages()" :key="code" @click="$root.$i18n.locale = code") {{ language }}
</template>
<script lang="ts">
import Vue from 'vue'
export default Vue.extend({
methods: {
languages: function () {
console.log(this.$languages)
}
}
})
</script>
But I get an error, saying "Property '$languages' does not exist on type 'CombinedVueInstance void; }, unknown, Readonly>>'"
Curiously, if I'm just trying to use it in the template, it works. The language name appears. It's just the typescript code that doesn't recognise the function.