Starting a Vue.js project with TypeScript and using single file components instead of class-styled ones has been my goal. However, I have encountered a recurring issue where I get error TS2339 when trying to reference my components' data using the "this" keyword:
export default {
data(){
return { x: 10 as number };
},
methods: {
foo() {
if(this.x > 10) {
return this.x;
}
}
}
}
This error always leads to "TS2339 Property 'x' does not exist on type 'CombinedVueInstance'