TLDR · PROGRAMMING, DESIGN & DATA SCIENCE
TYPE UNIONS DON'T ALWAYS COMPOSE WELL
Summary from the TLDR newsletter
TypeScript lets developers write type unions that often feel more ergonomic compared to other languages, which may force them to tag the union. These untagged unions often lead to cleaner user-side APIs that don't require boilerplate boxing up of values. However, if you have overlaps when using them, the result type might hold less information than you think. To get the composition to actually represent something like what you get with data types in other languages, make sure there is no overlap between the types.