import { createStore, Store as VuexStore, createLogger, CommitOptions, DispatchOptions, } from 'vuex'; import {getters, Getters} from "@/store/getters"; import {mutations, Mutations} from "@/store/mutations"; import {state, State} from "@/store/state"; import {actions, Actions} from "@/store/actions"; export type Store = Omit< VuexStore, "commit" | "getters" | "dispatch" > & { commit[1]>( key: K, payload: P, options?: CommitOptions, ):ReturnType; } & { getters: { [K in keyof Getters]: ReturnType }; } & { dispatch( key: K, payload: Parameters[1], options?: DispatchOptions ):ReturnType; }; export const store = createStore({ state, mutations, getters, actions, plugins: [createLogger()], }); // define your own `useStore` composition function export function useStore() { return store as Store; }