The first problem is usually how we choose our type parameters. There are two common approaches.
2/5🧵
Define a type parameter for the whole function, then use Parameters and ReturnType. While this approach might work in most cases, usually the types of interest are the parameters and return type, not the whole function type.
3/5🧵
The conditional types will also not forward generic types of the source function
4/5🧵
As a follow on to yesterday’s post (inspired by @dagda1's question), what is the difference between using any[], unknown[] or never[] as constraints to the function rest parameter in #TypeScript ?
The answer is that if you use a type parameter for the args, there isn’t much difference. You can’t call the function with anything that isn’t typed as A, since you can’t assign a concrete type to a type parameter.
2/6🧵 typescriptlang.org/play?#code/GYV…
If the rest parameter is in a function type constraint (the way I recommend you don’t do in the previous post), then we get differences.
3/6🧵