News for hackers. Stuff that matters.
Re:From Rust to TypeScript by eyelidlessness on Saturday September 12, 2020 @12:46PM (#24453685)
I don’t understand why so many people advise against TS enums. The string variant is no different at runtime from a const of the same mapping, but they also achieve nominal typing in an otherwise structural type system, which is super useful for preventing ambiguity errors
Re:From Rust to TypeScript by moogly on Saturday September 12, 2020 @05:08PM (#24455694)
I've done TypeScript for 5-6 years, in up to 100+k loc codebases, and never had a problem with enums, both with tsc and babel (so yeah, `const enum` no worky).

`Object.values(SomeEnum)` is pretty handy, something you can't do with string union types.

Re:From Rust to TypeScript by XVincentX on Saturday September 12, 2020 @01:02PM (#24453800)
See my response above!