I'm attempting to convert an app that was in development with just Javascript over to Typescript. I've ran into a problem I can't seem to solve. I have a computed property with a getter and a setter that won't compile when run through Webpack. I am not using the class decorator way of declaring components and am instead using the object literal syntax.
import Vue from "vue"
export default Vue.extend({
computed: {
prioritized: {
get(): any[] {
return this.$store.getters["blah"];
}
set(value): void {
//set value here
}
}
}
})
Below is the first error webpack gives me:
ERROR in ~listHome.ts(30,29) TS2339: Property '$store' does not exist on type '{ get(): any[]; set(value: unknown): void; }'.
I'm pretty new to Typescript to be honest, so I may be missing something simple here in my frustration of porting this app over.
Wow, figured it out.
I was missing the type declaration for "value" and it broke everything. FUN
get(): any[] {
return this.$store.getters["homeList/sortedPriority"];
},
set(value:any): void {
var test = 1;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With