Skip to content

Commit dbf5516

Browse files
committed
add missing default values for generic payload type
1 parent 00353eb commit dbf5516

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/small-store.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export type ActionPayload<ACTION extends string> = {
66
[KEY in ACTION]?: { [key: string]: any };
77
};
88

9-
export interface ActionMeta<ACTION extends string, PAYLOAD extends ActionPayload<ACTION>> {
9+
export interface ActionMeta<ACTION extends string, PAYLOAD extends ActionPayload<ACTION> = {}> {
1010
name: ACTION;
1111
payload: PAYLOAD[ACTION];
1212
}
@@ -19,13 +19,13 @@ export type ActionHandler<STATE, PAYLOAD> =
1919
| ((payload: PAYLOAD | never) => (state: STATE) => STATE)
2020
| ((payload: PAYLOAD | never) => Partial<STATE>);
2121

22-
export type EffectHandler<STATE, ACTION extends string, PAYLOAD extends ActionPayload<ACTION>> = (
22+
export type EffectHandler<STATE, ACTION extends string, PAYLOAD extends ActionPayload<ACTION> = {}> = (
2323
action: ActionMeta<ACTION, PAYLOAD>,
2424
state: STATE,
2525
dispatch: (action: ACTION, payload?: PAYLOAD[ACTION]) => void
2626
) => void;
2727

28-
export type Effects<STATE, ACTION extends string, PAYLOAD extends ActionPayload<ACTION>> = {
28+
export type Effects<STATE, ACTION extends string, PAYLOAD extends ActionPayload<ACTION> = {}> = {
2929
[KEY in ACTION]?: EffectHandler<STATE, ACTION, PAYLOAD>;
3030
};
3131

0 commit comments

Comments
 (0)