Closed mlegenhausen closed 2 years ago
Do
from Middleware
suffers from the same problem too.
add generic parameter to Do
Yes, that would do the trick, but it's rather ugly, I would prefer going with bindTo
.
The phantom type is set by a computation, which is always placed after Do
, so TypeScript can't ever infer it successfully. I can't find better solutions. What if we deprecate Do
in favour of just bindTo
?
With a useful comment for the bindTo
solution I think this sound like the best solution.
Reproduceable example
You can replace
apS
withapSW
,iapS
oriapSW
with the same type error.You can work around that issue by first binding via
RH.bindTo
and then add additional values viaapS
etc.A possible solution would be to add generic parameter to
Do
to allow the setting of a initial type but maybe there is a more elegant solution.