String Enums
👨💼 Great! Enums make status handling type-safe and readable.
🦉 Notice how switch statements work well with enums. TypeScript can check that
you've handled all cases if you add exhaustiveness checking:
switch (status) {
case OrderStatus.Pending:
return '...'
// ... other cases
default: {
const _exhaustive: never = status
return _exhaustive
}
}
This ensures you update the switch when adding new enum values.