-
-
Notifications
You must be signed in to change notification settings - Fork 15.3k
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
[Typescript] Reducer definition causes Typescript to fall with error #2424
Comments
Just had time for a quick look, but I think you just need to define the types of
Of course as soon as you try to reference other fields in Changing As a side note, I'm using |
@mindjuice the issue here is that I have to provide additional typedef for |
It gets worse in Typescript 2.4. The Reducer declaration really breaks big time there due to the work they did on strict contravariance for callback parameters. See the following discussion on the Typescript Issues page: https://github.com/Microsoft/TypeScript/issues/16795. At this point, the only way I see to make Redux work with Typescript 2.4 is to redefine the Reducer as you have noted above: export type Reducer<S> = <A extends Action>(state: S, action: A) => S; You can still create subclassed Actions for type checking. |
There's a pull request open for this: #2467 |
Redux: 3.6.0
Typescript: 2.3.3
compilerOptions.noImplicitAny
is set totrue
.Redux has next definitions.
Reducer:
Errors:
If definitons would have been changed it would solve problem.
Please explain what I do wrong.
The text was updated successfully, but these errors were encountered: