import './vue'
export class Store {
constructor(options: StoreOption);
state: S;
dispatch(mutationName: string, ...args: any[]): void;
dispatch
(mutation: MutationObject
): void;
replaceState(state: S): void;
watch {
type: string;
silent?: boolean;
payload?: P;
}
export interface Module, cb: (value: T) => void, options?: WatchOption): void;
hotUpdate(options: {
mutations?: MutationTree;
modules?: ModuleTree;
}): void;
subscribe(cb: (mutation: MutationObject {
state?: S;
mutations?: MutationTree;
modules?: ModuleTree;
plugins?: Plugin[];
strict?: boolean;
}
type Getter = (state: S) => T;
type Action = (store: Store, ...args: any[]) => any;
type Mutation = (state: S, ...args: any[]) => void;
type Plugin = (store: Store) => void;
export interface MutationTree {
[key: string]: Mutation;
}
export interface MutationObject {
state?: S;
mutations?: MutationTree;
modules?: ModuleTree;
}
export interface ModuleTree {
[key: string]: Module {
getters: { [key: string]: Getter };
actions: { [key: string]: Action };
}
export interface WatchOption {
deep?: boolean;
immidiate?: boolean;
}