So I have this array of object here:
const tabs = [
{ label: 'Profile', value: 'profile' },
{ label: 'Inbox', value: 'inbox' },
{ label: 'Settings', value: 'settings' },
] as const
And I want to map all value inside this tab variable:
const tabValues = tabs.map(tab => tab.value)
Though, the type result of tabValues is:
("profile" | "inbox" | "settings")[]
instead of:
["profile", "inbox", "settings"]
Is there a way to make it like the above?
I'm trying to put this inside zod.enum, which requires it to be an exact order.
z.enum(tabs.map(tab => tab.value))