-
-
Notifications
You must be signed in to change notification settings - Fork 170
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
MutationAction not having access to module state? #372
Comments
I agree it's not evident at all, and perhaps the fix can be done via Typescript by setting the right context |
I made a PR which documents how to "fix" this issue - #374 |
@NikhilVerma Thank you for that potential fix. I hoped it would allow me to move on with my project, after already having invested in the transition to this library, but unfortunately (as stated in the replies to your PR) Typescript still complains about changing the type of It actually seems backward to me that the type of @championswimmer What is the reason, in the first place, that the |
I've examined the code and saw the tricks employed in the decorators. const thisObj = { context }
addPropertiesToObject(thisObj, context.state)
addPropertiesToObject(thisObj, context.getters)
// and then
const actionPayload = await mutactFunction.call(thisObj, payload) This would make the |
Since the repo has not been updated in over a year, I have forked it and applied the update mention above, so that state and getters can be accessed from a To use my fork you can replace the "vuex-module-decorators": "github:ymarcov/vuex-module-decorators" then run |
Is this by design or am I doing something wrong ?
The snippet bellow breaks because
this.value
is undefined.When using
this.state.value
it works but the type is all wrong, so I get a lot of TS error.Am I missing something?
If possible, someone please send me a link to a Discord community with people who know Vuex Module Decorators.
The text was updated successfully, but these errors were encountered: