-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
useStore is missing a type declaration #1736
Comments
@ChrisShank Override the declare module "vuex" {
function useStore<T = any>(key?: string): T
} |
It seems that the type is difficult to cover, you can do this: // @ts-ignore
import { createStore, useStore as useVuexStore } from 'vuex'
const store = createStore<StoreState>({})
export default store
export function useStore(): typeof store {
return useVuexStore()
} |
@surmon-china I currently am here I think that a type should either be included with the package (similar to the one you first mentioned) or documented that the user is expected to provide their own shim. |
Thanks for the report! Yea we must add this one 👍 |
kiaking
added a commit
that referenced
this issue
Apr 30, 2020
ktsn
pushed a commit
that referenced
this issue
Apr 30, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Version
4.0.0-beta.1
Reproduction link
https://github.com/ChrisShank/vue-next-webpack-preview
Steps to reproduce
Remove the type declaration of 'useStore' I added in 'vuex-shim.d.ts', and there will be a compile-time TS error.
What is expected?
The type for useStore to exist.
What is actually happening?
On the line:
There is an error:
The text was updated successfully, but these errors were encountered: