O
O
Okitoff2019-12-19 18:19:36
typescript
Okitoff, 2019-12-19 18:19:36

Are there any miracles with Redux-Saga?

Hello.
I have two absolutely identical pieces of code:

import { createStore, applyMiddleware, Store } from 'redux';
import createSagaMiddleware from 'redux-saga';
import { rootSaga } from './sagas';
import { rootReducer, IAppState } from './reducers';

const sagaMiddleware: any = createSagaMiddleware();

export function configureStore(): Store<IAppState> {
  const store = createStore(rootReducer as any, (applyMiddleware(sagaMiddleware))
  ) as Store<IAppState>;

  sagaMiddleware.run(rootSaga);

  return store;
}

So if you hover over the rootSaga with the mouse, in one code it shows:
(alias) function rootSaga(): Generator<ForkEffect<void>[], void, unknown>
import rootSaga

and in another:
(alias) function rootSaga(): Generator<ForkEffect[], void, unknown>
import rootSaga

I feel because of this login in the first case, the sagas connected like this do not work for me:
export function* rootSaga() {
  yield [fork(newsSaga)];
}

In this place, when you hover, it shows:
(alias) function newsSaga(): Generator<ForkEffect<never>, void, unknown>
import newsSaga

And in the working version there is no disbelief (((.
What am I doing wrong?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question