by kamilafsar · 4y ago · 0 comments
Besides, sometimes number values make more sense then string values. Especially when you want to do bitwise operations, which are not possible on string unions.
Still, I'd prefer:
const MyNumericEnum = {
One: 0b001,
Two: 0b010,
Three: 0b100
} as const
type MyNumericEnum = typeof MyNumericEnum[keyof typeof MyNumericEnum]
Just for explicitness. But that's my subjective opinion