I have an array of objects:
const arr = [{
value: 'value1',
key: 'key1'
}, {
value: 'value2',
key: 'key2'
}]
What I want to achieve is to get an union type having the values of value
key.
type Values = 'value1' | 'value2';
How can I define the type to generate it automatically from the array of objects?