News for hackers. Stuff that matters.
Re:TypeScript Features to Avoid by spoiler on Thursday January 20, 2022 @09:00AM (#30008957)
Why do you find them self documenting?

Usually it's just

    enum Method {
      Get = "GET"
      // ...
    }
I usually always put doc comments on enums and their variants.

Regarding why numeric ones are (only sometimes) more useful than string values: bit flags comes to mind, faster comparison of numbers than strings (not always tho... unless this is a misconception, but I don't believe so), you mentioned smaller bundle size already.

As for "auto" enums: the fact they're numbers now is an implementation detail. They could be unique Symbols in a future versions of typescript. You can do that manually now too, but I'm talking about the automatic (without assignment) syntax.

Regarding article: I... Half-agree. But I'd not completely disregard/avoid enums. At the very least, they can be useful to help model some behaviours/states in more readable, accessible, and coherent way (Other comments went into a more in-depth defence of enums, thought).

Re:TypeScript Features to Avoid by KuhlMensch on Thursday January 20, 2022 @11:39AM (#30011208)

   enum Method {
      Get = "method/GET"
      // ...
    }
The string value can be very helpful for the reader - be it a human or log ingestor