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
Since this change pull/2967 Typescript can't compile my reducer based on generic state.
The following error is being generated: Argument of type '(state: TState, action: object & { type: string; }) => TState' is not assignable to parameter of type 'OnReducer<TState, [ActionCreator<string, Creator<any[], object>>]>'.
Type 'TState' is not assignable to type 'TState extends object ? { [P in keyof TState]: TState[P]; } : TState'.
Type 'object' is not assignable to type 'TState extends object ? { [P in keyof TState]: TState[P]; } : TState'.(2345)
Minimal reproduction of the bug/regression with instructions:
Since this change pull/2967 Typescript can't compile my reducer based on generic state.
The following error is being generated:
Argument of type '(state: TState, action: object & { type: string; }) => TState' is not assignable to parameter of type 'OnReducer<TState, [ActionCreator<string, Creator<any[], object>>]>'.
Type 'TState' is not assignable to type 'TState extends object ? { [P in keyof TState]: TState[P]; } : TState'.
Type 'object' is not assignable to type 'TState extends object ? { [P in keyof TState]: TState[P]; } : TState'.(2345)
Minimal reproduction of the bug/regression with instructions:
Reproduction in the Typescript playground.
Describe any alternatives/workarounds you're currently using
I am currently casting the state returned by the reducer to 'any'.
Other information:
If accepted, I would be willing to submit a PR for this feature
[ ] Yes (Assistance is provided if you need help submitting a pull request)
[X ] No
The text was updated successfully, but these errors were encountered: