-
Notifications
You must be signed in to change notification settings - Fork 18
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
GetterHandler type missing parameters? #11
Comments
Were you able to get this to work? |
I also am trying to get this to work.. seems even the defined signature does not work correctly, RootState is also not injected into the read.. |
I'm trying to remember the exact context of this, but I found a workaround for accessing the root state from within a module that might be helpful to others. In my index.ts I export my root vue instance |
OK after some digging its a bug in Vuex-Typescript, but you can get around the issue by doing this
basically Vuex-Typescript does not pass all the params and the interface they have defined is not what vuex supports, but under the covers its still vuex and that still passes the parameters correctly. The above passed Typescript checking and stuff. |
@d1820, @skateborden - I know you've likely moved on from this issue. But could you check out #22 to see if you agree with the solution? I didn't realize that the bug I was trying to fix had already been documented here 😀 |
Copy of PR on vuex-typescript: istrib/vuex-typescript#22 Fixes bug that did not allow users to access RootState from typed getters Bug on vuex-typescript: istrib/vuex-typescript#11
Hi all - I realize very few people are likely going to be coming across this, but since this repo hasn't been updated since 11/13/17, I decided to fork & publish a maintained version. You can find that here: https://github.com/jackkoppa/typesafe-vuex It includes the fix for this bug, + specs to make sure you can use |
I've been trying out this approach but ran into an issue with specifying a vuex getter with more than just the state; i.e. (state, getters, rootState, rootGetters).
Shouldn't the following be GetterHandler<state: TModuleState, getters: any, rootState: TRootState, rootGetters: any) instead? I just started using Typescript so I don't know if I'm missing something.
https://github.com/istrib/vuex-typescript/blob/master/src/index.ts#L12
The text was updated successfully, but these errors were encountered: