Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
epolanski
· 4y ago · 0 comments
Union types are the way to go in 99% of cases you need enums.
Comments
[–]
_jumble
4y ago
Yes, 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];`