Open git9am opened 3 years ago
Thanks for your suggestion! You have to give it a new name like yieldCall. eg.
const _call = effects.call;
currentThis.effects.yieldCall = function*(func: any, ...args: any) {
return (yield _call(func, ...args));
};
Maybe you can give me a PR!
This project offers a way to ensure typing between Components and Models. But we still have typing issues within Models since
yield
ends up with anany
return type, as is explained under microsoft/TypeScript#2983. E.g. in redux-saga Models we often have cases like:Models plays an important role in firing API calls and gathering API responses. And since that's error-prone for data typing, it would be very helpful to make those effect calls type sensitive.
For example, we may wrap
effects.call
into another generator with type declaration, so that we have:In
lib/BaseModel.d.ts
,In
src/decorators/effect.ts
,And in model files, by replacing
yield
withyield*
,Will such a patch make sense to this project?