TypeScript: not possible to use a component's store
and context
props when wrapped with connect
HOC
#2147
Closed
1 task done
What version of React, ReactDOM/React Native, Redux, and React Redux are you using?
What is the current behavior?
Components connected to Redux using the
connect
HOC do not type-check when used with TypeScript if they have one of the following props not connected to Redux:context
store
(could not find this reported anywhere)This is unfortunate for me, because I work on a webapp in the domain of app stores, where
store
is a prop name we often use (andcontext
as well).The following compilation error messages are demonstrated in this demo:
What is the expected behavior?
I should be able to provide the component the
store
orcontext
props without a type error.Perhaps with some way of opting out of the
context
andstore
props offered by theconnect
HOC at the type level, or a more complete handling of these props that does not interfere when connecting a component that expects them (extending the existingConnectPropsMaybeWithoutContext
approach).(For reference, older versions of the TypeScript types (from DefinitelyTyped) did not expose the react-redux
context
andstore
props in connected components, though I understand this is not something you would want to go back to.)Which browser and OS are affected by this issue?
n/a
Did this work in previous versions of React Redux?
The text was updated successfully, but these errors were encountered: