--

Hey Scott. Thanks for reading and responding! By far my main reason preferring string union types over enums is to be able to use Intellisense to see the string literal without having to click through to another file. I tried to come up with some other reasons, and you're right! They're not great! But I'm still not going to use enums in my code because it's too much of a mental burden to chase down the subtypes and remember them. Cheers!

--

--

Dr. Derek Austin 🥳
Dr. Derek Austin 🥳

Written by Dr. Derek Austin 🥳

Hi, I'm Doctor Derek! I've been a professional web developer since 2005, and I love writing about programming with JavaScript, TypeScript, React, Next.js & Git.

No responses yet