Simpler Variadic Function Types in TypeScript (part 1)
Variadic functions, such as the common
zip function on arrays, are convenient and remove the need for lots of specific arity-function variants, e.g.,
zip4, etc. However, they can be difficult and tedious to type correctly in TypeScript when the return type depends on the parameter types, and the parameter types are heterogeneous.
Given a typical
zip on arrays:
const a: number = [1, 2, 3]