News for hackers. Stuff that matters.
Re:Rewriting TypeScript in Rust? You'D have to be by esprehn on Wednesday December 14, 2022 @09:18PM (#33994231)
Allowing literal strings and type aliases of unions of strings to represent enums doesn't seem unreasonable. It's the same concept as many other languages with some extra quotes, ex. https://ocaml.org/docs/data-types#a-simple-custom-type
Re:Rewriting TypeScript in Rust? You'D have to be by goto11 on Thursday December 15, 2022 @11:33AM (#34001967)
"Some extra quotes" make a big difference though. The type of

   Red
in OCaml is pretty unambiguous, but the type of

   "Red"
in Typescript is not. The typesystem has to do a lot of work to support strings as both enum values, type descriptors and characters-strings.