How to use the typesafe-actions.isOfType function in typesafe-actions

To help you get started, we’ve selected a few typesafe-actions examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github piotrwitek / react-redux-typescript-guide / playground / src / features / todos / epics.ts View on Github external
export const logAddAction: Epic = (
  action$,
  state$,
  { logger }
) =>
  action$.pipe(
    filter(isOfType(todosConstants.ADD)), // action is narrowed to: { type: "ADD_TODO"; payload: string; }
    tap(action => {
      logger.log(
        `action type must be equal: ${todosConstants.ADD} === ${action.type}`
      );
    }),
    ignoreElements()
  );