Skip to content

Commit d367145

Browse files
author
fanwei
committed
fix(vuex): correct return type of useStore
1 parent b273427 commit d367145

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ router.push('/login');
3333
|Declaration|Description|
3434
|-|-|
3535
|`createStore`<S>(options: StoreOptions<S>): Store<S>||
36-
|`useStore`<S = any>(): Store<S> \| undefined||
36+
|`useStore`<S = any>(): Store<S>|
3737

3838
### vue2-helpers/vue-router
3939
|Declaration|Description|

src/vuex.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ export function createStore<S>(options: StoreOptions<S>) {
1010
}
1111

1212

13-
export function useStore<S = any>() {
13+
export function useStore<S = any>(): Store<S> {
1414
const inst = getCurrentInstance()
1515
if (inst) {
16-
return inst.proxy.$store as Store<S>
16+
return inst.proxy.$store
1717
} else {
1818
warn(OUT_OF_SCOPE)
1919
}
20+
return undefined as any
2021
}

0 commit comments

Comments
 (0)