I'm trying to implement a tslint custom rule to manually force and check yield typings inside of generator-based sagas from redux-saga. As the statuses of #2983 and similar issues are unknown it seems like custom rule is the only way for now.
So, at the moment I'm able to only force setting explicit type on the left side of yield expression:
const timePeriod = yield select(FilterSelectors.timePeriod);
^^^ error from custom rule - value has implicit any type
The next step is to extract the types of the left and right sides of such yield and it's possible with public TypeChecker#getTypeFromTypeNode.
Now when both types are available they could be checked for assignability with helpers under // TYPE CHECKING section in compiler/checker.ts in createTypechecker factory function (like checkTypeAssignableTo), but unfortunately they are isolated inside that factory.
Therefore I suggest exporting that helpers from compiler/checker.ts on the module-level (or under a namespace, or even as TypeChecker static fields), they will be very helpful for implementing such custom rules.
I'm trying to implement a tslint custom rule to manually force and check yield typings inside of generator-based sagas from redux-saga. As the statuses of #2983 and similar issues are unknown it seems like custom rule is the only way for now.
So, at the moment I'm able to only force setting explicit type on the left side of yield expression:
The next step is to extract the types of the left and right sides of such yield and it's possible with public
TypeChecker#getTypeFromTypeNode.Now when both types are available they could be checked for assignability with helpers under
// TYPE CHECKINGsection incompiler/checker.tsincreateTypecheckerfactory function (likecheckTypeAssignableTo), but unfortunately they are isolated inside that factory.Therefore I suggest exporting that helpers from
compiler/checker.tson the module-level (or under a namespace, or even asTypeCheckerstatic fields), they will be very helpful for implementing such custom rules.