I have currently the following code which works, X is a union with all the types defined in MyType, I would like to know if TS has a better way, or an utility fn to get the same result.
type MyType = {
name :string,
age: 15
}
type X = MyType[keyof MyType] // string | number
>Solution :
There isn’t a predefined one. But you could write your own:
type ValueOf<T> = T[keyof T]