Aljabr: I Brought Rust Enums to TypeScript (Again). This Time It's Actually Good.

rust dev.to

Two years ago, I wrote a blog post called "I Was Bored So I Brought Rust Enums to TypeScript: A Tale of Questionable Life Choices". In it, I documented my descent into madness attempting to build a Rust-style Result type in TypeScript. The result was… functional. Barely. It had issues. The tag was enumerable (which meant JSON.stringify would include it, breaking everything), the type inference was held together with duct tape, and honestly, I'm pretty sure it only worked because TypeScript felt

Read Full Tutorial open_in_new
arrow_back Back to Tutorials