Hacker News new | ask | show | jobs
by randomdata 844 days ago
Typescript has actual enums. They behave just like Go's (for better or worse).

It's not clear why Rust got confused.

1 comments

yep, sorry about that, I misremembered TypeScript as having the same "kind of enums" as Rust.
TypeScript has discriminated unions if that's what you were thinking of

https://www.typescriptlang.org/docs/handbook/2/narrowing.htm...