You can already define a typed zip function that accepts a fixed number of parameters as follows:
function zip2<A, B>(a: A[], b: B[]): Array<[A, B]>
I'm wondering if it is now possible to create a zip function that accepts rest parameters with a generic return type?
function zip(...args) {
return args[0].map((_, c) => args.map(row => row[c]));
}
As far as I can tell the new generic rest parameters added in Typescript 3.0 <T extends any[]>
is still not enough to type the previous function?