4 ms·
I dislike TypeScript enums for two reasons: 1. They have a runtime representation unlike most of the rest of TypeScript 2. They follow nominal typing instead
by shepherdjerred 2y ago
I dislike TypeScript enums for two reasons:
1. They have a runtime representation unlike most of the rest of TypeScript
2. They follow nominal typing instead of structural typing, again unlike the rest of TypeScript
IMO it's best to use string union types instead of enums. If you need to map that to another representation you can use a function or a record.
- deleted 2y ago[deleted]