-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
RTK Query endpoint data selectors expecting an incorrect RootState type #1879
Comments
Can you show an actual example of this failing? It isn't checking every single reducer in the entire store. Rather, it's just checking the specific |
yeah! lemme repro in a codesandbox. can't share work code 👀 |
just added a test slice to the existing store you can see the type error on line 9 of the
|
perhaps it needs to |
Hmm. Okay, yeah, that does seem odd. Not sure why it wouldn't have shown up before now, though? |
yeah super weird. currently using version 1.7.1 of redux toolkit. in the type error it also fallbacks to trying to match |
Heh, I just ran into this myself on my own day project while upgrading to RTK 1.7.1 :) so, yeah, very real and needs to be fixed. |
I have a similar issue, I have very little experience with the types but it appeared that
worked but the any sucks here (not sure how you'd go about improving that though) |
That should be fixed by #1977. Could you please try the CI build available at https://ci.codesandbox.io/status/reduxjs/redux-toolkit/pr/1977 (see "local install instructions") and verify if it fixes the problem for you? |
This still seems to be an issue for selectors which use endpoints that are provided via EDIT: it works in this minimal example so it's probably just me |
Say you have a redux store setup using redux toolkit. your store type will look something like this
and when you integrate the autogenerated RTK Query reducer into an existing redux store (link to docs) your store type will look something like
which will fail type checking when passing in the state from
store.getState
into a RTK Query endpoint data selector which is expecting a type of:since every reducer path in the store is not of the
CombinedState<...>
typeThe text was updated successfully, but these errors were encountered: