diff --git a/README.md b/README.md index 2a78dbe..fd32473 100644 --- a/README.md +++ b/README.md @@ -13,8 +13,9 @@ Running demo ``` git clone https://github.com/byte-fe/react-modelx.git cd react-model/example -yarn -yarn dev +npm i +npm run initial +npm run dev ``` install package diff --git a/package.json b/package.json index 0863a10..454db1c 100644 --- a/package.json +++ b/package.json @@ -17,13 +17,13 @@ "author": "ArrayZoneYour ", "license": "MIT", "dependencies": { - "immer": "^1.9.3" + "immer": "^1.9.3", + "react": "^16.7.0-alpha.2", + "react-dom": "^16.7.0-alpha.2" }, "devDependencies": { "@types/react": "^16.7.11", "@types/react-dom": "^16.0.11", - "react": "^16.7.0-alpha.2", - "react-dom": "^16.7.0-alpha.2", "typescript": "^3.2.1" }, "repository": { diff --git a/src/index.d.ts b/src/index.d.ts index d550e4f..ebea893 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -18,7 +18,7 @@ interface Models { [name: string]: ModelType } -type ModelType = { +type ModelType = { actions: { [P in keyof ActionKeys]: Action } @@ -36,8 +36,3 @@ type getConsumerActionsType = { } type Get = T[N] - -type UseStore = ( - name: K, - models?: M -) => [Get, getConsumerActionsType>] diff --git a/src/index.tsx b/src/index.tsx index a815c58..b055498 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -25,7 +25,10 @@ const registerModel = (models: M) => { ...models } return { useStore } as { - useStore: UseStore + useStore: ( + name: K, + models?: M + ) => [Get, getConsumerActionsType>] } }