Patrick Burris

Software Developer

TypeScript discriminated unions, and trying to mimic Rust enums

Can we re-create Rust enums in TypeScript? We can try! I show how we can use type unions to mimic some of the behavior of Rust enums, and then take a look at the differences between the TS implementation and the Rust implementation.