Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Redux saga typescript type error in yield all

I'm trying very simple example from redux-saga page.

function* saga(): SagaIterator {
  yield takeEvery(T.GET_CREDENTIALS, getCredentials);
}

export default function* rootSaga() {
  yield all([
    saga(),
  ]);
}

But I get typescript error:

Argument of type 'IterableIterator<RootEffect | TakeEffect | 
ChannelTakeEffect<any> | PutEffect<any> | ChannelPutEf...' is not 
assignable to parameter of type '{ [key: string]: Effect; }'.
Index signature is missing in type 'IterableIterator<RootEffect | 
TakeEffect | ChannelTakeEffect<any> | PutEffect<any> | 
ChannelPutEf...'.

What I'm doing wrong? Thanks for help

like image 490
mauron85 Avatar asked Oct 21 '25 00:10

mauron85


1 Answers

Since links to solutions apparently get downvoted, this is the solution:

export default function* rootSaga() {
  yield all([
    call(saga()),
  ]);
}
like image 71
marcindobry Avatar answered Oct 23 '25 16:10

marcindobry