Why TypeScript Enums Are Terrible But Union Types Are Great

A deep dive into the pitfalls of TypeScript Enums and the power of Union Types, or why I refactor all my Enums to Union Types.

Dr. Derek Austin 🥳
Totally TypeScript
Published in
7 min readApr 13, 2023

--

Photo by Tatiana Rodriguez on Unsplash

Introduction: TypeScript Enums vs. Union Types

--

--

Dr. Derek Austin 🥳
Totally TypeScript

I love working with Next.js + Tailwind CSS ♦ Lead UI / UX Product Engineer ♦ React Software Architect ♦ SEO & Web Performance Expert ♦ I love accessibility 🥰