/* * @Description: app moudle * @Author: ZY * @Date: 2020-12-23 10:25:37 * @LastEditors: ZY * @LastEditTime: 2021-01-05 15:39:49 */ import { Store as VuexStore, CommitOptions, DispatchOptions, Module } from 'vuex' // TODO: How to surpass cyclical dependency linting errors cleanly? import { RootState } from '../../' import { state } from './state' import { mutations, Mutations } from './mutations' import { actions, Actions } from './actions' import type { AppState } from './state' import getters from './getters' export { AppState } export type AppStore = Omit, 'getters' | 'commit' | 'dispatch'> & { commit[1]>( key: K, payload: P, options?: CommitOptions ): ReturnType } & { dispatch( key: K, payload: Parameters[1], options?: DispatchOptions ): ReturnType }; export const store: Module = { state, mutations, actions, getters // TODO: With namespaced option turned on, having problem how to use dispatch with action types... // But without it, a bigger store might have clashes in namings // namespaced: true, }