Skip to content

Commit 22e4576

Browse files
committed
feat(state): make sideEffectFn optional in ActionEffects
1 parent 9b84858 commit 22e4576

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

libs/state/actions/src/lib/rx-actions.spec.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,11 @@ describe('actions fn', () => {
102102
const t = { se: () => void 0 };
103103
const spyBehavior = jest.fn();
104104
const dummyBehaviour = (o$) => o$.pipe(tap(spyBehavior));
105-
const spyT = jest.fn((_: any) => void 0);
106105

107-
const sub = component.actions.onProp(dummyBehaviour, spyT);
106+
const sub = component.actions.onProp(dummyBehaviour);
107+
component.actions.prop('p');
108+
expect(spyBehavior).toHaveBeenCalledTimes(1);
109+
sub();
108110
component.actions.prop('p');
109111
expect(spyBehavior).toHaveBeenCalledTimes(1);
110112
});

libs/state/actions/src/lib/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export type ActionObservables<T extends Actions> = {
5151
export type ActionEffects<T extends Actions, O = T> = {
5252
[K in ExtractString<T> as `on${Capitalize<K>}`]: (
5353
fn: OperatorFunction<T[K], T[K] | any>,
54-
sideEffectFn: (value: T[K] | any) => void
54+
sideEffectFn?: (value: T[K] | any) => void
5555
) => () => void;
5656
};
5757

0 commit comments

Comments
 (0)