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
Unexpected type error when exactOptionalPropertyTypes is enabled:
import{typeReducer,combineReducers}from'redux';typeMyAction={type: 'foo'};typeState=string;declareconstnested: Reducer<State,MyAction>;typeCombined={nested: State};// ❌ Error// Type 'Reducer<{ nested: string; }, MyAction, Partial<{ nested: never; }>>' is not assignable to type 'Reducer<Combined, MyAction, Partial<Combined>>'.// Type 'string' is not assignable to type 'never'.constcombined: Reducer<Combined,MyAction,Partial<Combined>>=combineReducers({ nested });
This only happens when using a custom action type, i.e. changing MyAction to the Redux Action type makes the error disappear.
I believe we need to thread the custom action type through combineReducers to PreloadedStateShapeFromReducersMapObject so we can use it in the conditional type.
Steps to Reproduce
See above.
What is the expected behavior?
No type error.
Environment Details
N/A
The text was updated successfully, but these errors were encountered:
Prior Issues
Not that I could find unfortunately.
I plan to submit a PR to fix this.
What is the current behavior?
Unexpected type error when
exactOptionalPropertyTypes
is enabled:This only happens when using a custom action type, i.e. changing
MyAction
to the ReduxAction
type makes the error disappear.I believe we need to thread the custom action type through
combineReducers
toPreloadedStateShapeFromReducersMapObject
so we can use it in the conditional type.Steps to Reproduce
See above.
What is the expected behavior?
No type error.
Environment Details
N/A
The text was updated successfully, but these errors were encountered: