Skip to content

Commit 434a93e

Browse files
fix(type): fix useStore type issue (#165)
1 parent 3f94f3a commit 434a93e

3 files changed

Lines changed: 8 additions & 6 deletions

File tree

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
22
"name": "react-model",
3-
"version": "4.0.0-rc.0",
3+
"version": "4.0.0-rc.1",
44
"description": "The State management library for React",
55
"main": "./dist/react-model.js",
66
"umd:main": "./dist/react-model.umd.js",
77
"types": "./src/index",
88
"scripts": {
9-
"build": "microbundle -o ./dist --sourcemap false",
9+
"build": "microbundle --sourcemap false --jsx React.createElement",
1010
"commit": "git-cz",
1111
"lint-ts": "tslint -c tslint.json 'src/**/*.ts'",
1212
"lint-md": "remark .",
@@ -38,7 +38,7 @@
3838
"cz-conventional-changelog": "^3.0.0",
3939
"husky": "^4.0.2",
4040
"jest": "^24.1.0",
41-
"microbundle": "^0.12.0",
41+
"microbundle": "^0.12.3",
4242
"prettier": "^2.0.0",
4343
"react": "^16.8.4",
4444
"react-dom": "^16.8.4",

src/index.d.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,9 @@ interface APIs<M extends Models> {
159159
selector?: S
160160
) => M[K] extends API
161161
? S extends (...args: any) => void
162-
? ReturnType<S>
162+
? Equals<S, undefined> extends true
163+
? [ReturnType<Get<M[K], 'getState'>>, Get<M[K], 'actions'>]
164+
: ReturnType<S>
163165
: ReturnType<Get<M[K], 'useStore'>>
164166
: M[K] extends ModelType
165167
? S extends (...args: any) => void

tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"target": "es6",
55
"allowSyntheticDefaultImports": true,
66
"moduleResolution": "node",
7-
"outDir": "./dist",
7+
"outDir": "dist",
88
"experimentalDecorators": true,
99
"jsx": "react",
1010
"lib": ["dom", "dom.iterable", "es2017"],
@@ -16,5 +16,5 @@
1616
"strict": true
1717
},
1818
"include": ["./src/*"],
19-
"exclude": ["node_modules"]
19+
"exclude": ["node_modules", "./dist/*"]
2020
}

0 commit comments

Comments
 (0)