17 ms·
The biggest issue I have with enums is that unlikely virtually everything else in TypeScript, they are a "thing" (you correctly mentioned in your next comment t
by shados 6y ago
The biggest issue I have with enums is that unlikely virtually everything else in TypeScript, they are a "thing" (you correctly mentioned in your next comment that they don't have to be depending on their declaration, but that nuance will be lost on 99% of users). They're not just "types on top of JS", which defeats a lot of expectations in TypeScript. They're also not standard JS, so best practices with them aren't nearly as studied.
If they were to be part of the standard, it would be another story.
- danfo 6y agoYes. There are so few TS features that are non-type-level and non-standard. One option is to lint against these few features and call it a day. { "rules": { "no-restricted-syntax": [ "error", { "selector": "TSEnumDeclaration", "message": "Enum restricted." }, { "selector": "ClassDeclaration[abstract=true]", "message": "Abstract class restricted." }, { "selector": "TSParameterProperty", "message": "Parameter property restricted." } ] } } (TS decorators are already marked experimental)