typed-redux-saga
typed-redux-saga copied to clipboard
Macro doesn't seem to do anything
import { select } from 'typed-redux-saga/macro';
const getToken = (state: RootState) => state.user.account?.token; // type: (...) => string | undefined
function* fetchAlertsSaga() {
const token = yield select(getToken);
// TypeScript error here
// TS7057: 'yield' expression implicitly results in an 'any' type because
// its containing generator lacks a return-type annotation.
// ...
}
babel-plugin-macros
is installed via react-scripts
dependencies:
@...
├─┬ [email protected]
│ └─┬ [email protected]
│ └── [email protected] deduped
└─┬ [email protected]
└── [email protected]
What I do wrong? Should I configure macro somehow?
If I switch import of typed-redux-saga/macro
to the typed-redux-saga
and add '*'
to the yields, the correct type is inferred:
const token = yield* select(getToken); // string | undefined
I also having this issue.
I am also having this issue.