import { ActionContext } from "vuex" import { CreatedStore, DirectActionContext, DirectGetterContext } from "./direct-types" export function createDirectStore< O extends WithOptionalState, S = StateOf >(options: O & StoreOptions): CreatedStore export function defineModule< O extends WithOptionalState, S = StateOf >(options: O & ModuleOptions): O export function defineModules(): ((modules: T & ModulesImpl) => T) export function defineGetters(): ((getters: T & GettersImpl) => T) export function defineMutations(): ((mutations: T & MutationsImpl) => T) export function defineActions(actions: T & ActionsImpl): T export function localGetterContext( args: [any, any, ...any[]], options: O ): DirectGetterContext export function localActionContext( originalContext: ActionContext, options: O ): DirectActionContext /** * @deprecated Use `defineModule`. */ export function createModule< O extends WithOptionalState, S = StateOf >(options: O & ModuleOptions): O /** * @deprecated Use `defineModules`. */ export function createModules(): ((modules: T & ModulesImpl) => T) /** * @deprecated Use `defineGetters`. */ export function createGetters(): ((getters: T & GettersImpl) => T) /** * @deprecated Use `defineMutations`. */ export function createMutations(): ((mutations: T & MutationsImpl) => T) /** * @deprecated Use `defineActions`. */ export function createActions(actions: T & ActionsImpl): T export type WithOptionalState = { state: StateDeclaration } | {} export type StateOf = O extends { state: StateDeclaration } ? O["state"] : {} type StateDeclaration = any | (() => any) /* * Types for Vuex Store Options */ export interface StoreOrModuleOptions { state?: S extends object ? ((() => S) | S) : never, getters?: GettersImpl mutations?: MutationsImpl actions?: ActionsImpl modules?: ModulesImpl plugins?: PluginImpl[] } export interface StoreOptions extends StoreOrModuleOptions { strict?: boolean } export interface ModuleOptions extends StoreOrModuleOptions { namespaced?: boolean } export interface ModulesImpl { [moduleName: string]: ModuleOptions } export interface GettersImpl { [name: string]: GetterImpl } export type GetterImpl = (state: S, getters: G, rootState: any, rootGetters: any) => any export interface MutationsImpl { [name: string]: MutationImpl } export type MutationImpl = (state: S, payload: any) => void export interface ActionsImpl { [name: string]: ActionImpl } export type ActionImpl = (context: ActionContext, payload: any) => any export type PluginImpl = (store: any) => any