TypeScript Converting Possible Types Into Array

Viewed 191

I have a type declaration something like

type myType = "TYPE_1" | "TYPE_2" | "TYPE_3"

and I want to convert that to a string list,

const myTypeArr = ["TYPE_1", "TYPE_2", "TYPE_3"]

so I could iterate over it. Is it possible?

0 Answers
Related