score:14

Accepted answer

What you could do (what I did in my case, at least) was what was pointed out in this link. Currently, you seem only to output the OwnerId string to the generator and this shouldn't work like it is, as the generator there basically takes the arguments dispatched, an object with the type and the rest of the arguments sent to the dispatcher. The "correct" way to do would be to have a type definition that encompasses the type, with something like:

type Params = { OwnerId: string, type: string }
export function* getListEventsByUserSaga({ OwnerId }: Params) {
...
}

score:0

instead of

export function* getListEventsByUserSaga(action: { payload: any; }) {
...
//logic
...
}

use this

export function* getListEventsByUserSaga(action: any) {
...
//logic
...
}

it works for me

score:5

In your getListEventsByUserSaga generator, you are declaring the action as {OwnerId:string} without a type. If you try to declare it with a type, this will get rid of the error. You can use ReturnType.

export function* getListEventsByUserSaga({OwnerId} : ReturnType<typeof fetchMyEventsListUserLoad>) {
  try {
    // code
  } catch (error) {
    // code
  }
}

https://github.com/redux-saga/redux-saga/issues/1883


Related Query

More Query from same tag