3 ms·
> 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
by bgschiller 6y 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-typescript-3-351i https://dev.to/ascorbic/creating-a-typed-compose-function-in...
2: https://stackoverflow.com/a/53066700/1586229 https://stackoverflow.com/a/53066700/1586229
3: https://github.com/reduxjs/redux/blob/686d29b5d4e2dcb6709c16e31b79ecde90763156/index.d.ts#L451-L541 https://github.com/reduxjs/redux/blob/686d29b5d4e2dcb6709c16...