Creating a Array of objects from the union type.

Consider
type Gender = "Male" | "Female"

I want to create a custom array of object with a prop value to be in Gender Union
type SelectOptions = {
label: string,
value: // Either Male or Female
}[]. // I want both Male and Female SelectOption object to be present
Was this page helpful?