Unfortunately TypeScript's enums have various shortcomings compared to powerful sum types in languages like Rust:
- https://stackoverflow.com/questions/40275832/typescript-has-...
- https://github.com/microsoft/TypeScript/issues/32690
In a TS codebase I'm currently working on, we have the policy of never using "plain" TS enums. Instead, we have a tool that generates our own enum objects using a schema and a generator script for the cases where we want "rich" enums. For other use cases, we use string unions a lot (in combination with a helper function that allows exhaustive matching).