Heres the situation: suppose I have an Array with the following structure:
const myArray = [
{ label: 'A title', value: 'A'},
{ label: 'B title', value: 'B'},
{ label: 'C title', value: 'C'},
] as const;
const myValues = myArray.map((v) => v.value);
when I map through the array returning only the value property, I hoped for the variable myValues
type to be:
['A', 'B', 'C']
but instead I got:
('A' | 'B' | 'C')[]
Is it possible to achieve what I'm looking for?
Thanks in advance!