I'm using typescript syntax in my vuejs project that integrated with vuex. I want to use mapState method as computed in my .ts file but I got a syntax error. Currently I am using docs suggested syntax for computed function, I mean:
get counter() {
return this.$store.state.count;
}
If you read the Vuex docs you will see that using Vuex in this way instead of using mapState is very repetitive. Using mapState is very easy and useful in large applications. I want to use mapState in my Typescript component and I don't know the right way. I've tried the way below to use the mapState function and it didn't work.
get mapState({
counter:count
});
// or
get mapState(['name', 'age', 'job'])
I'd be grateful if someone could help me.