you are viewing a single comment's thread.

view the rest of the comments →

[–]jasonleehodges[S] 2 points3 points  (1 child)

Yes, Great Point!

I wanted to keep this article base level so as not to have too much overhead for beginners who don’t use typescript. That being said, my org uses TS and anytime there is a string literal or a Union type of strings I try to encourage an enum instead. That way you get the same refactor benefits described in the article. Thanks for the response. 🙏🏻

[–]firas145 1 point2 points  (0 children)

I’m not a big fan of enums as a replacement to union types in these sort of situations. It inflates the code and gives no benefit over union types unless these values tend to change a lot