Skip to content

Commit daa9b44

Browse files
committed
Allow mutating registry reducers in types
1 parent 5f230cb commit daa9b44

2 files changed

Lines changed: 2 additions & 4 deletions

File tree

packages/core/src/registry/action.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,12 @@ export type TrrackActionFunction<
1111
undo: PayloadAction<UndoActionPayload, UndoActionType>;
1212
};
1313

14-
export type ProduceWrappedStateChangeFunction<T> = (state: T, args: any) => T
14+
export type ProduceWrappedStateChangeFunction<T> = (state: T, args: any) => T;
1515

1616
export type StateChangeFunction<State, Payload> = (
1717
state: State,
1818
payload: Payload
19-
) => ReturnType<ProduceWrappedStateChangeFunction<State>>;
20-
19+
) => void | ReturnType<ProduceWrappedStateChangeFunction<State>>;
2120

2221
export type Label = string;
2322
export type LabelGenerator<Args> = (args: Args) => Label;

packages/core/src/registry/reg.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ describe('Registry', () => {
2020
'add',
2121
(state: { count: number }, amount: number) => {
2222
state.count += amount;
23-
return state;
2423
}
2524
);
2625

0 commit comments

Comments
 (0)