typesafe-actions icon indicating copy to clipboard operation
typesafe-actions copied to clipboard

Update redux-saga usage docs

Open Kamahl19 opened this issue 4 years ago • 5 comments

Redux-saga solved (https://github.com/microsoft/TypeScript/pull/30790) the long-opened issue (https://github.com/Microsoft/TypeScript/issues/2983) mentioned in docs https://github.com/piotrwitek/typesafe-actions#with-redux-saga-sagas , so I suppose they can be updated with better example

Kamahl19 avatar Jul 24 '19 11:07 Kamahl19

Hey @Kamahl19, thanks for the heads up.

Are you able to provide an updated example?

piotrwitek avatar Jul 24 '19 16:07 piotrwitek

I'm also interested in this. Actually the example with saga in the README doesn't work :/

pybuche avatar Oct 24 '19 16:10 pybuche

@pybuche what do you mean doesnt work

Kamahl19 avatar Oct 24 '19 16:10 Kamahl19

There is a typo in the code example, but I realized it only a few hours ago :)

function* addTodoSaga(action: ReturnType<typeof fetchTodosAsync.request>): Generator {
  try { // missing this line
    const response: Todo[] = yield call(todosApi.getAll, action.payload);

    yield put(fetchTodosAsync.success(response));
  } catch (err) {
    yield put(fetchTodosAsync.failure(err));
  }
}

pybuche avatar Oct 25 '19 15:10 pybuche

@pybuche created a bug for it #184, up for grabs

piotrwitek avatar Oct 25 '19 21:10 piotrwitek