Union types to solve magic strings problems

With the union types of typescript you are solving the problems of magic strings ? Or it's better to make an object?
3 Replies
Sybatron
Sybatron13mo ago
You can have fixed values for certain attribute with union type Or just have different attributes based on fixed value (identifier)
brunoeduardodev
brunoeduardodev13mo ago
I found union types usually less annoying and less "boilerplate-like"
akerbeltz
akerbeltz13mo ago
yep but what option in my question es better? i think the same but maybe i'm missing something else