How to get property based union type from an array of objects
11/21/2023
const arr = [
{
property: 'one',
},
{
property: 'two',
},
] as const;
type Property = Pick<typeof arr[number], 'property'>['property'];
// ^? type Property = 'one' | 'two'