I am trying to type sagas. I am using the flow-typed definitions: https://github.com/flowtype/flow-typed/blob/master/definitions/npm/redux-saga_v0.13.x/flow_v0.36.x-v0.37.x/redux-saga_v0.13.x.js
export function* fetchUsers(): Generator<IOEffect, void, any> {
const users = yield call(UserApi.list)
yield put(fetchUserSucc(users))
}
But flow keeps complaining:
Identifier
IOEffect
Could not resolve name
What am I doing wrong?
You need to import IOEffect from the libdef like this:
import type { IOEffect } from 'redux-saga/effects';
Source: https://github.com/flowtype/flow-typed/issues/645
Try using this:
import { type Saga } from 'redux-saga';
export function* fetchUsers(): Saga<void> {
some logic...
}
It works right for me
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With