I have two implementations of the same effect, and both work. I'm having a hard time understanding the differences between the two and which is more "correct".
Please find them below:
Option 1. IDE cannot figure out the type for instance
in the last map
.
pollingStarted$ = createEffect(() =>
this.actions$.pipe(
ofType(pollingStarted),
mergeMap(action => action.instances),
map(instance => performRequest({ instance }))
)
);
Option 2. All types work out and make sense. This is more correct to me but I want to figure out and understand the differences.
pollingStarted$ = createEffect(() =>
this.actions$.pipe(
ofType(pollingStarted),
mergeMap(({ instances }) =>
instances.map(instance => performRequest({ instance }))
)
)
);