Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi!
Really like the package. We were recently trying to access RootState from a getter, and realized that if we follow this library's type expectations for a getter, we're not actually getting the right parameters in order to work with root state.
As mentioned in the commits, this is the line in Vuex where the type of a getter is defined: https://github.com/vuejs/vuex/blob/dev/types/index.d.ts#L97
And here it is being used in the docs: https://vuex.vuejs.org/guide/modules.html#accessing-global-assets-in-namespaced-modules
However, the current
GetterHandler
for this library only has 2 params (state
androotState
), and by leaving outgetters
androotGetters
, a user trying to accessrootState
will try to use the 2nd argument, when in fact they should be trying to use the 3rd argument.This PR is a potentially breaking change, because it changes the order of arguments that
GetterHandler
expects. However, I'd have to guess that no one up to this point would have been accessingrootState
successfully, since they would have been targeting the wrong argument. So if we're OK with the change, I think the published version could still be a minor version, since it's more of a bugfix than a full API change. Totally happy to discuss. Also, we could just add a second type,GetterHandlerExtended
, andread
could accept eitherGetterHandler
orGetterHandlerExtended
. That way, anyone still using the original handler wouldn't see an issue. It seems like the wrong approach, though, if the current version is indeed incorrect.Really happy to discuss, and thanks again for a great library - it's allowed us to keep using TypeScript on our project, which has been a boon