direct-vuex
direct-vuex copied to clipboard
rootGetterContext expects different arguments than provided by the getter
Following the example in the Readme I create a getter in my root store
getters: {
myGetter(...args) {
const {state, getters} = rootGetterContext(args);
}
}
I am getting the following type error
Argument of type '[RootState, any, any, any]' is not assignable to parameter of type '[any, any]'.
Types of property 'length' are incompatible.
Type '4' is not assignable to type '2'.ts(2345)
It seems to be expecting
(method) myGetter(state: RootState, getters: any, rootState: any, rootGetters: any): void
As a workaround
myGetter(storeState, storeGetters): ExplicitType {
const { state, getters } = rootGetterContext([storeState, storeGetters]);
seems to work
I'm experiencing this same error with these versions:
- vue: 2.6.11
- vuex: 3.6.2
- direct-vuex: 0.12.1