import { Module, Plugin, Store, StoreOptions } from "vuex"; export declare type MutationHandler = (state: S, payload: P) => void; export declare type ActionHandler = (context: BareActionContext, payload: P) => Promise | T; export declare type GetterHandler = (state: S, getters: G, rootState: R) => T; declare type Promisify = T extends PromiseLike ? T : Promise; export interface BareActionContext { state: S; rootState: R; getters: G; } export interface ModuleBuilder { /** The namespace of this ModuleBuilder */ readonly namespace: string; /** Creates a strongly-typed nested module within this module */ module(namespace: string, initialState: M): ModuleBuilder; /** Gets an existing nested module within this module */ module(namespace: string): ModuleBuilder; /** Set the initial state for an existing module */ setInitialState(initialState: S): void; /** Creates a strongly-typed commit function for the provided mutation handler */ commit

(handler: MutationHandler): () => void; commit

(handler: MutationHandler): (payload: P) => void; commit

(handler: MutationHandler, name: string): () => void; commit

(handler: MutationHandler, name: string): (payload: P) => void; /** Creates a strongly-typed dispatch function for the provided action handler */ dispatch(handler: ActionHandler): () => Promise; dispatch(handler: ActionHandler): (payload: P) => Promise; dispatch(handler: ActionHandler): () => Promisify; dispatch(handler: ActionHandler): (payload: P) => Promisify; dispatch(handler: ActionHandler, name: string): () => Promise; dispatch(handler: ActionHandler, name: string): (payload: P) => Promise; dispatch(handler: ActionHandler, name: string): () => Promisify; dispatch(handler: ActionHandler, name: string): (payload: P) => Promisify; /** Creates a strongly-typed read function for the provided getter function */ read(handler: GetterHandler): () => T; read(handler: GetterHandler, name: string): () => T; /** Creates a method to return this module's state */ state(): () => S; /** Output a Vuex Module definition. Called after all strongly-typed functions have been obtained */ vuexModule(): Module; _provideStore(store: Store): void; } export interface VuexStoreOptions { plugins?: Plugin[]; } export interface StoreBuilder { /** Creates a ModuleBuilder for the namespace provided */ module(namespace: string, state: S): ModuleBuilder; /** Gets an existing ModuleBuilder for the namespace provided */ module(namespace: string): ModuleBuilder; /** Output a Vuex Store after all modules have been built */ vuexStore(): Store; /** Output a Vuex Store and provide options, e.g. plugins -- these take precedence over any auto-generated options */ vuexStore(overrideOptions: StoreOptions): Store; /** Creates a strongly-typed commit function for the provided mutation handler */ commit

(handler: MutationHandler): () => void; commit

(handler: MutationHandler): (payload: P) => void; commit

(handler: MutationHandler, name: string): () => void; commit

(handler: MutationHandler, name: string): (payload: P) => void; /** Creates a strongly-typed dispatch function for the provided action handler */ dispatch(handler: ActionHandler): () => Promise; dispatch(handler: ActionHandler): (payload: P) => Promise; dispatch(handler: ActionHandler): () => Promisify; dispatch(handler: ActionHandler): (payload: P) => Promisify; dispatch(handler: ActionHandler, name: string): () => Promise; dispatch(handler: ActionHandler, name: string): (payload: P) => Promise; dispatch(handler: ActionHandler, name: string): () => Promisify; dispatch(handler: ActionHandler, name: string): (payload: P) => Promisify; /** Creates a strongly-typed read function for the provided getter function */ read(handler: GetterHandler): () => T; read(handler: GetterHandler, name: string): () => T; /** Creates a method to return the root state */ state(): () => R; /** Dynamically register module */ registerModule(namespace: string): void; /** WARNING: Discards vuex store and reset modules (non intended for end-user use) */ reset(): void; } /** Get a reference to the default store builder */ export declare function getStoreBuilder(): StoreBuilder; /** Get a reference to a named store builder */ export declare function getStoreBuilder(name: string): StoreBuilder; export {};