Skip to main content

One post tagged with "design-patterns"

View All Tags

Cleaner, Safer Code with Discriminated Unions

· 12 min read
Steve Konves
Basketry maintainer

Learn how to improve your code quality and type safety with discriminated unions, and use Basketry to streamline the process.

What are discriminated unions?​

Discriminated unions, also known as tagged unions or algebraic data types, are a powerful feature in many modern programming languages that allow you to define a type that can take on several different but related forms.

Photo of a large, white sign with the letters 'UNION' against a light blue sky, mounted on top of a white brick building.