瀏覽代碼

add typescript definition (#152)

Kaorun343 9 年之前
父節點
當前提交
695797c4c2
共有 2 個文件被更改,包括 32 次插入0 次删除
  1. 20 0
      index.d.ts
  2. 12 0
      tsconfig.json

+ 20 - 0
index.d.ts

@@ -0,0 +1,20 @@
+export interface ConstructorOption {
+    state?: any;
+    mutations?: any;
+    middlewares?: {
+        snapshot: boolean;
+        onInit: Function;
+        onMutation: Function;
+    }[];
+    strict?: boolean;
+    modules?: any;
+}
+
+export class Store<S> {
+    constructor(obj: ConstructorOption);
+    state: S;
+    dispatch(mutationName: any, ...args: any[]): void;
+    watch(pathOrGetter: (string | Function), cb: Function, options: any): void;
+}
+
+export function install(...args: any[]): any;

+ 12 - 0
tsconfig.json

@@ -0,0 +1,12 @@
+{
+    "compilerOptions": {
+        "module": "commonjs",
+        "target": "es5",
+        "noImplicitAny": true,
+        "sourceMap": false,
+        "experimentalDecorators": true
+    },
+    "exclude": [
+        "node_modules"
+    ]
+}