|
@@ -1,93 +1,66 @@
|
|
|
-declare namespace Vuex {
|
|
|
- class Store<S> {
|
|
|
- constructor(options: StoreOption<S>);
|
|
|
+import './vue'
|
|
|
|
|
|
- state: S;
|
|
|
+export class Store<S> {
|
|
|
+ constructor(options: StoreOption<S>);
|
|
|
|
|
|
- dispatch(mutationName: string, ...args: any[]): void;
|
|
|
- dispatch<P>(mutation: MutationObject<P>): void;
|
|
|
+ state: S;
|
|
|
|
|
|
- replaceState(state: S): void;
|
|
|
+ dispatch(mutationName: string, ...args: any[]): void;
|
|
|
+ dispatch<P>(mutation: MutationObject<P>): void;
|
|
|
|
|
|
- watch<T>(getter: Getter<S, T>, cb: (value: T) => void, options?: WatchOption): void;
|
|
|
+ replaceState(state: S): void;
|
|
|
|
|
|
- hotUpdate(options: {
|
|
|
- mutations?: MutationTree<S>;
|
|
|
- modules?: ModuleTree;
|
|
|
- }): void;
|
|
|
+ watch<T>(getter: Getter<S, T>, cb: (value: T) => void, options?: WatchOption): void;
|
|
|
|
|
|
- subscribe(cb: (mutation: MutationObject<any>, state: S) => void): () => void;
|
|
|
- }
|
|
|
-
|
|
|
- function install(Vue: vuejs.VueStatic): void;
|
|
|
-
|
|
|
- interface StoreOption<S> {
|
|
|
- state?: S;
|
|
|
+ hotUpdate(options: {
|
|
|
mutations?: MutationTree<S>;
|
|
|
modules?: ModuleTree;
|
|
|
- plugins?: Plugin<S>[];
|
|
|
- strict?: boolean;
|
|
|
- }
|
|
|
-
|
|
|
- type Getter<S, T> = (state: S) => T;
|
|
|
- type Action<S> = (store: Store<S>, ...args: any[]) => any;
|
|
|
- type Mutation<S> = (state: S, ...args: any[]) => void;
|
|
|
- type Plugin<S> = (store: Store<S>) => void;
|
|
|
-
|
|
|
- interface MutationTree<S> {
|
|
|
- [key: string]: Mutation<S>;
|
|
|
- }
|
|
|
-
|
|
|
- interface MutationObject<P> {
|
|
|
- type: string;
|
|
|
- silent?: boolean;
|
|
|
- payload?: P;
|
|
|
- }
|
|
|
-
|
|
|
- interface Module<S> {
|
|
|
- state?: S;
|
|
|
- mutations?: MutationTree<S>;
|
|
|
- modules?: ModuleTree;
|
|
|
- }
|
|
|
+ }): void;
|
|
|
|
|
|
- interface ModuleTree {
|
|
|
- [key: string]: Module<any>;
|
|
|
- }
|
|
|
+ subscribe(cb: (mutation: MutationObject<any>, state: S) => void): () => void;
|
|
|
+}
|
|
|
|
|
|
- interface ComponentOption<S> {
|
|
|
- getters: { [key: string]: Getter<S, any> };
|
|
|
- actions: { [key: string]: Action<S> };
|
|
|
- }
|
|
|
+export function install(Vue: vuejs.VueStatic): void;
|
|
|
|
|
|
- interface WatchOption {
|
|
|
- deep?: boolean;
|
|
|
- immidiate?: boolean;
|
|
|
- }
|
|
|
+export interface StoreOption<S> {
|
|
|
+ state?: S;
|
|
|
+ mutations?: MutationTree<S>;
|
|
|
+ modules?: ModuleTree;
|
|
|
+ plugins?: Plugin<S>[];
|
|
|
+ strict?: boolean;
|
|
|
+}
|
|
|
+
|
|
|
+type Getter<S, T> = (state: S) => T;
|
|
|
+type Action<S> = (store: Store<S>, ...args: any[]) => any;
|
|
|
+type Mutation<S> = (state: S, ...args: any[]) => void;
|
|
|
+type Plugin<S> = (store: Store<S>) => void;
|
|
|
|
|
|
- function createLogger<S>(option: LoggerOption<S>): Plugin<S>;
|
|
|
+export interface MutationTree<S> {
|
|
|
+ [key: string]: Mutation<S>;
|
|
|
+}
|
|
|
|
|
|
- interface LoggerOption<S> {
|
|
|
- collapsed?: boolean;
|
|
|
- transformer?: (state: S) => any;
|
|
|
- mutationTransformer?: (mutation: MutationObject<any>) => any;
|
|
|
- }
|
|
|
+export interface MutationObject<P> {
|
|
|
+ type: string;
|
|
|
+ silent?: boolean;
|
|
|
+ payload?: P;
|
|
|
}
|
|
|
|
|
|
-declare namespace vuejs {
|
|
|
- interface ComponentOption {
|
|
|
- vuex?: Vuex.ComponentOption<any>;
|
|
|
- store?: Vuex.Store<any>;
|
|
|
- }
|
|
|
+export interface Module<S> {
|
|
|
+ state?: S;
|
|
|
+ mutations?: MutationTree<S>;
|
|
|
+ modules?: ModuleTree;
|
|
|
+}
|
|
|
|
|
|
- interface Vue {
|
|
|
- $store?: Vuex.Store<any>;
|
|
|
- }
|
|
|
+export interface ModuleTree {
|
|
|
+ [key: string]: Module<any>;
|
|
|
}
|
|
|
|
|
|
-declare module 'vuex' {
|
|
|
- export = Vuex
|
|
|
+export interface VuexComponentOption<S> {
|
|
|
+ getters: { [key: string]: Getter<S, any> };
|
|
|
+ actions: { [key: string]: Action<S> };
|
|
|
}
|
|
|
|
|
|
-declare module 'vuex/logger' {
|
|
|
- export default Vuex.createLogger;
|
|
|
+export interface WatchOption {
|
|
|
+ deep?: boolean;
|
|
|
+ immidiate?: boolean;
|
|
|
}
|