|
|
|
|
|
by MBCook
478 days ago
|
|
What do people find works better as a string enum replacement? const Thing {
one: “one”,
two: “two”,
three: “three”
} as const
Or just type Thing = “one” | “two” | “three”
I’ve been thinking of getting rid of the simple string enums I have but it’s not clear to me why one is preferred over the other by people. |
|
If you need the actual strings to iterate over or validate against, deriving the value from an const array is helpful: