[HN Gopher] In Defence of TypeScript Enums
       ___________________________________________________________________
        
       In Defence of TypeScript Enums
        
       Author : romellem
       Score  : 12 points
       Date   : 2025-04-01 17:05 UTC (5 hours ago)
        
 (HTM) web link (yazanalaboudi.dev)
 (TXT) w3m dump (yazanalaboudi.dev)
        
       | koshdim wrote:
       | Nice article, clearly defines the scope for enums and why it is
       | so in TS. I had the same feeling and use enums a lit less than in
       | C#, because of mentioned limitations, but they're still useful
       | for right purpose
        
       | tengbretson wrote:
       | `if (color === "Red") {`
       | 
       | This counter example against using unions of literals would
       | result in a compiler error ts(2367). Which only furthers the
       | argument for using unions of literals instead.
        
       | paulddraper wrote:
       | > Enums Are Meant To Be Symbolic
       | 
       | And yet you can't use symbols [1].
       | 
       | Author gives a valiant effort, but is defending the indefensible.
       | 
       | [1] https://github.com/microsoft/TypeScript/issues/18408
        
       ___________________________________________________________________
       (page generated 2025-04-01 23:01 UTC)