I started a vue.js project with typescript and I want to use single file components, and not class-styled ones. I constantly get error TS2339 when trying to reference my components' data, with the "this" keyword:
export default {
data(){
return { x: 10 as number };
},
methods: {
foo() {
if(this.x > 10) {
return this.x;
}
}
}
}
It always leads to "TS2339 Property 'x' does not exist on type 'CombinedVueInstance