Consider the following typescript code:
function concatTuples<T>(first: [...T[]], second: [...T[]]): [...T[]] {
return [...first, ...second];
}
const result = concatTuples([0, 1], [2, 3]);
So the function joins tuples. Currently there is no way of knowing what the lenght of the returned tuple is.
Current type of result: number[].
What I'd like the type to be : [number, number, number, number].
So that the size of the returned tuple/array needs to be dynamically infered from function arguments.
Is there any way of achieving this? I looked around the docs and didn't find any straightforward solution.