Recently, I was attempting to develop a zipper for arrays. For instance, if the user inputs 3 arrays with sizes of 3, 5, and 12, the output array of tuples would be the size of the largest array. The output consists of tuples containing elements at a specified index, with null appearing if there is no index.
I experimented with a generic approach to enhance its usability.
So, I implemented a utility static function:
public static zip<T>(arrays : T[][]) : () => [dynamic tuple here somehow of types T][] {
However, I encountered an issue right from the start - how can I define a function that returns an array of tuples of dynamic size? Is this even feasible? As the TypeScript documentation lacks such an example, I suspect my code may not function correctly, requiring me to implement workarounds like returning 'any'.