Modified the Home.vue file generated using the vue cli to create a basic vue project using Typescript but not using the using the class-style vue-property-decorators. After creating a computed property Vetur complains with message
Property 'name' does not exist on type 'CombinedVueInstance
When running the component it works fine.
Reverting to Vetur version 0.18.1 also seems to fix the problem.
See screenshot for error message, and notice syntax error in the computed title.
You need a return type annotation of the computed property.
See: https://vuejs.org/v2/guide/typescript.html#Annotating-Return-Types
Thank you @ktsn
Adding a return type to the computed property fixed the problem.
I had the same problem.
Thanks for the solution @ktsn.
Make sense.
Hi @ktsn
Would you happen to know how to annotate a new variable declared in the created hook?
created() {
this.commentPadding = 15;
},
I've attempted this.commentPadding: number but didn't work.
Most helpful comment
You need a return type annotation of the computed property.
See: https://vuejs.org/v2/guide/typescript.html#Annotating-Return-Types