You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What version of React, ReactDOM/React Native, Redux, and React Redux are you using?
React: 18.3.1
ReactDOM: 18.3.1
Redux: 5.0.1
React Redux: 9.1.2
What is the current behavior?
I got a type error after updating to react-redux 9.1.2 from 7.1.33, so there were no errors at 7.1.33.
It's simple. When I use shallowEqual in useSelector, useSelector returns any type.
It reproduces, when I use useSelector directly or via
What version of React, ReactDOM/React Native, Redux, and React Redux are you using?
What is the current behavior?
I got a type error after updating to react-redux 9.1.2 from 7.1.33, so there were no errors at 7.1.33.
It's simple. When I use shallowEqual in useSelector, useSelector returns
any
type.It reproduces, when I use
useSelector
directly or viaexport const useAppSelector = useSelector.withTypes<IAppState>();
In the example below,
editors
would be of typeany
.const editors = useAppSelector(selectEditorsActive, shallowEqual);
Even if the selector has a type declaration
And if I delete shallowEqual as the second argument everything will be fine.
const editors = useAppSelector(selectEditorsActive);
Right now I use next code for correct type checking
export const useAppSelector: TypedUseSelectorHook<IAppState> = useSelector;
I tried to make a demo with bug, but there is no bug in clean project
https://codesandbox.io/p/sandbox/polished-breeze-v2dmxw?file=%2Fsrc%2Fhooks.ts%3A4%2C55
What is the expected behavior?
I can use useSelector.withTypes with shallowEqual, without any need in TypedUseSelectorHook.
Which browser and OS are affected by this issue?
None, it's type error
Did this work in previous versions of React Redux?
The text was updated successfully, but these errors were encountered: