Is there a way to merge tuples in TypeScript such that one tuple is added at the end of another? Here is an example:
type MergeTuple<A extends any[], B extends any[]> = [...A, ...B];
I have tried the following approach:
type MergeTuple<A extends any[], B extends any[]> = [A[0], B[0]];
However, this method only works with a static count of items. For example:
MergeTuple<['a'], ['b']> // results in ['a', 'b']
But it does not work for cases like this:
MergeTuple<['a', 'b'], ['c']> // results in ['a', 'c'], whereas I expected ['a', 'b', 'c']