A Full Stack Developer who specializes in Javascript Technologies across the whole stack (Node.js, Express, React). Experience building web applications with backend API Systems using Typescript.
Unfortunately, I currently haven't got the time to do all of this, so here's only a small overview of the differences:
It looks a bit like the example in redux-observable.js.org/docs/basic..., but instead of ofType(...), you are using isActionOf(...) from typesafe-actions, which requires you to define the action with createAction from the same package as already shown in this guide.
One thing that I would also add for convenience is that you can aggregate the action types automatically using the package utility-types:
// ./mytypes.ts
import { $call } from 'utility-types';
import * as MyActions from './actions';
// ... insert your other types here
const allActions = Object.values(MyActions).map($call);
export type MyAction = typeof allActions[number];
This way you automatically get the types for all your actions, which then are also checked when you use them inside your epics.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Any chance for a post like this but using that approach(RxJS + Redux-Observables)?
Unfortunately, I currently haven't got the time to do all of this, so here's only a small overview of the differences:
It looks a bit like the example in redux-observable.js.org/docs/basic..., but instead of
ofType(...)
, you are usingisActionOf(...)
from typesafe-actions, which requires you to define the action withcreateAction
from the same package as already shown in this guide.One thing that I would also add for convenience is that you can aggregate the action types automatically using the package utility-types:
This way you automatically get the types for all your actions, which then are also checked when you use them inside your epics.