Skip to content

Commit

Permalink
fix(store): allow a generic reducer (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
preda7or authored Jun 11, 2022
1 parent 3c18605 commit 615e722
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export interface ImmerOnReducer<State, AC extends ActionCreator[]> {
* Immer wrapper around `on` to mutate state
*/
export function immerOn<State, Creators extends ActionCreator[]>(
...args: [...creators: Creators, reducer: ImmerOnReducer<State, Creators>]
...args: [...creators: Creators, reducer: ImmerOnReducer<State extends infer S ? S : never, Creators>]
): ReducerTypes<State, Creators> {
const reducer = (args.pop() as Function) as ActionReducer<State>;
return (on as any)(...(args as ActionCreator[]), immerReducer(reducer));
Expand Down

0 comments on commit 615e722

Please sign in to comment.