This isn't as smart as that: it expects that they all return the same type. If be interested to see if there's a way of typing the other sort though.
the only way I see it is via N+1 different generic types - though that is ofc. not as nice as your generic implementation.
All the best, Sebastian
There is a way to simulate it, but wiht limitations github.com/reduxjs/redux/blob/686d...
Yeah, I can't see any way that doesn't boil down to "use lots of repetitive overloads"
If you use infix operators (read: ascii art method names) you can get typing of composed functions with different signatures, without overloading:
Compose and pipe "infix operators"
With the downside that you can't just spread an array of functions into compose like you can with yours.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.