2 ms·
Union types are the way to go in 99% of cases you need enums.
by epolanski 5y ago
Union types are the way to go in 99% of cases you need enums.
- _jumble 5y agoYes, and generating those unions from a const array gives you even further flexibility with runtime access: `const myStrArray = ["a", "b", "c"] as const; type MyStrType = typeof myStrArray[number];`