piotrwitek / typesafe-actions

Typesafe utilities for "action-creators" in Redux / Flux Architecture
https://codesandbox.io/s/github/piotrwitek/typesafe-actions/tree/master/codesandbox
MIT License
2.41k stars 98 forks source link

isActionOf - Argument contains array with invalid element at index 0 #237

Closed ArielGueta closed 4 years ago

ArielGueta commented 4 years ago

I'm creating action and use it with isActionOf according to the docs:

import { isActionOf, action } from 'typesafe-actions';

export const ACTION = (id) => action('Name', { id });

actions$.pipe(
  filter(isActionOf(ACTION)),
)

But I get an error:

Argument contains array with invalid element at index 0, it should be an action-creator instance from "typesafe-actions"

What am I missing?

Thanks.

"typescript": "~3.9.3"

Lemmmy commented 4 years ago

Care to share how you fixed it/why you closed the issue?

ArielGueta commented 4 years ago

I changed it to:

export const ACTION = (id) => createAction('Name', ({ id }) => ({ id }))();