vuex uses module, and then wants to use store.state.a to report type errors in the TS file
// store/index.ts
// ...
Vue.use(Vuex);
const store: StoreOptions<RootState> = {
modules: {
a
}
};
export default new Vuex.Store<RootState>(store);
// a.ts
// ...
export const state: State = {
id: 1
};
const namespaced: boolean = true;
export const user: Module<UserState, RootState> = {
namespaced,
state
};
// use.ts
// TSVue
store.state.a.id // [ts] "{}" "a" [2339]
how should I correct this so that this exception is not thrown?
Thank you!