Looking for a way to work with a union of tuples:
type TupleUnion = ["a", string] | ["b", number] | [Foo, Bar] // ...
In need of defining a function that can handle any type K extends TupleUnion[0]
, with the return type being inferred as the second element in the tuple:
function f<K extends TupleUnion[0]>(key: K): ValueFor<K>
How should I define
ValueFor<K extends TupleUnion[0]>
to get the desired outcome?