Open
Description
Version
2.5.17
Reproduction link
Steps to reproduce
- use vue-cli init a ts hello-world project .
- code like that
<script lang="ts">
import Vue from "vue";
export default Vue.extend({
name: "HelloWorld",
props: {
msg: String
},
data():any {
return {
wtf: this.initData(), // throw ts error : Property 'initData' does not exist on type 'CombinedVueInstance<Vue, {}, {}, {}, Readonly<{ msg: string; }>>'.
}
},
methods: {
initData():any {
return {
a: ''
}
},
},
});
</script>
What is expected?
How can i fix it ?
What is actually happening?
Property 'initData' does not exist on type 'CombinedVueInstance<Vue, {}, {}, {}, Readonly<{ msg: string; }>>'.