Trying to setup a project with typescript and redux. I am getting this error
Generic type \'Dispatch\' requires 1 type argument(s).
<
I solved this by downgrading to Redux 3.7
. It has proper typings (There still aren't typings for Redux 4.0
). There are some Github issues where they discuss about it (here and here).
It looks to me like you are indeed facing the same issue you linked. While we wait and see if 7mllm7's pull request is merged, you can use his modified version of the react-redux types. I'd recommend the following approach:
git clone --depth=1 https://github.com/7mllm7/DefinitelyTyped
types/react-redux
folder into your project (suppose for example you copy it to a folder named react-redux.fixed
).react-redux.fixed/package.json
to replace "private": "true"
with "name": "@types/react-redux"
.package.json
, specify the version of @types/react-redux
as ./react-redux.fixed
.npm install
. npm will make a symlink from node_modules/@types/react-redux
to react-redux.fixed
.Compared to just editing the file in node_modules/@types/react-redux
, this way npm knows you are using a modified version of the package and won't overwrite it. (This process deserves to be widely known; I'll find a better place to document it if I have time.)