Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

createLogic type can be string array #176

Open
gregbown opened this issue Dec 25, 2020 · 0 comments
Open

createLogic type can be string array #176

gregbown opened this issue Dec 25, 2020 · 0 comments

Comments

@gregbown
Copy link

gregbown commented Dec 25, 2020

I noticed that the editor complained about the type not being correct for passing an array of types.
According to documentation it is:
required string, regex, Symbol, array of str/regex/Symbol, use '*' for all

logic.prototype = {
  persistEffect: createLogic({
    type: [
      events.ADD_TODO,
      events.DELETE_TODO,
      events.EDIT_TODO,
      events.COMPLETE_TODO,
      events.COMPLETE_ALL_TODOS,
      events.CLEAR_COMPLETED
    ],
    process({actions, action}, dispatch, done) {
      console.log(`Intercept TODO ${action.type}`);
      dispatch(actions.persistTodo(action));
      done();
    }
  })

Adding Array in logic.d.ts, this corrects it.

    export type PrimitiveType<Type extends string | symbol, InputPayload> =
      | Type
      | RegExp
      | Array<string>
      | Function;

Using Windows 10, Node 12.20, redux 4.0.5, redux-logic 3.0.2, rxjs 6.6.3

Thank you for the awesome library btw!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant