redux-logic icon indicating copy to clipboard operation
redux-logic copied to clipboard

createLogic type can be string array

Open gregbown opened this issue 4 years ago • 0 comments

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!

gregbown avatar Dec 25 '20 21:12 gregbown