fix: useAccessor type is evaluating to `never` in Vue 3 (without Nuxt)
MaxLeiter opened this issue ยท 1 comments
MaxLeiter commented
Whenever I try and access accessor
the evaluated type is never
. Did I do something wrong in setup?
๐ ๏ธ To reproduce
Steps to reproduce the behavior:
Basic version of my code:
import {
useAccessor,
getterTree,
mutationTree,
actionTree,
} from 'typed-vuex'
export interface State {
...
}
const state = () => ({
...
} as State)
const getters = getterTree(state, {
....
})
const mutations = mutationTree(state, {
...
})
const actions = actionTree(
{ state, getters, mutations },
{
...
}
)
const storePattern = {
state,
mutations,
actions,
}
const store = createStore(storePattern)
// Settings module is registered dynamically because it benefits
// from a direct reference to the store
store.registerModule("settings", createSettingsStore(store));
export const accessor = useAccessor(store, storePattern)
export type Accessor = typeof accessor;
๐ Expected behaviour
It should be properly typed so I can use my store
โน๏ธ Additional context
I'm using Vue 3 if that matters; I didn't see anything about it in the docs.
MaxLeiter commented
This was due to bad typing on my end. a helpful tooltip elsewhere explained why it was evaluated to never.