Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Curried produce return type cannot be handled by combineReducers, non curried works though #461

Closed
LunaticPoring opened this issue Nov 11, 2019 · 1 comment

Comments

@LunaticPoring
Copy link

馃悰 Bug Report

When using typescript, redux, and curried producer from immer altogether, the return type of the curried reducer is not understood by combineReducers which leads to "unknown" type combined reducer and impossibility to access the states

To Reproduce

Create a curried producer as a reducer.
Use combineReducers on this producer
Type of said combineReducer is "unknown"

Expected behavior

A clear and concise description of what you expected to happen.

Link to repro (highly encouraged)

https://codesandbox.io/s/typescript-react-redux-f4pvk

In rdx.ts, the type of "reduce" is :
const reduce: redux.Reducer<{ counterReducer: State; }, redux.AnyAction>

And the type of curriedReduce is :
const curredReduce: redux.Reducer<unknown, redux.AnyAction>

Therefore after creating the store, we are unable to access its "sub-states"

Environment

  • Immer version: 5.0.0
@mweststrate
Copy link
Collaborator

Just tested this against the upcoming Immer 5.3, with TypeScript 3.7.3 and the latest Redux 4.0.5, and the issue doesn't appear there anymore. Added unit test to prevent regressions in the future.

mweststrate added a commit that referenced this issue Jan 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants