Hacker News new | ask | show | jobs
by bgschiller 2157 days ago
> E.g. I couldn’t for the life of me annotate the return value of the pipe function

Don't feel bad, no one can do that (yet! I think it should be possible with Variadic Tuple Types, coming in TS 4). There are a couple of attempts[1][2], but they all lack in some way. Redux does it with a boatload of overloads [3].

1: https://dev.to/ascorbic/creating-a-typed-compose-function-in...

2: https://stackoverflow.com/a/53066700/1586229

3: https://github.com/reduxjs/redux/blob/686d29b5d4e2dcb6709c16...