If I have tuples similar to this for keys and values:
type Keys = ['North', 'East', 'South', 'West'];
type Values = ['n', 'e', 's', 'w'];
Is there a way to achieve a structure like this:
type OneToOne<
K extends [...(string | number | symbol)[]],
V extends [...unknown[]]
> = Record<K[0], V[0]>
& Record<K[1], V[1]>
& Record<K[2], V[2]>
& Record<K[3], V[3]>;
How can this be adapted for tuples or string unions of any length? The specific format of tuples or unions for K
and V
doesn't matter as long as they are of the same length.