Vuex 4 is a great companion to Vue 3, but Vuex is falling behind on Typescript support. While waiting for better typing support in Vuex 5 or using Pinia, this wrapper might help.
Using this wrapper will correctly infer arguments and return types on your state, actions, getters and mutations.
It works both within your store(s) and any Vue components where you use the mapActions
, mapState
, mapGetters
or mapMutations
helpers from Vuex.
No more any
will help you find many errors at compile-time!