Union Types is an actively used design pattern. In computer science, a union is a value that may have any of several representations or formats within the same position in memory; that consists of a variable that may hold such a data structure. Some programming languages support special data types, called union types, to describe such values and variables. In other words, a union type definition will specify which of a number of permitted primitive types may be stored in its instances, e.g., "float or long integer". Read more on Wikipedia...

?Years Old
  • Union Types ranks in the top 25% of entities I track
  • the Union Types wikipedia page
  • Have a question about Union Types not answered here? Email me and let me know how I can help.

Languages with Union Types include graphql, typescript

Example from graphql:

union SearchResult = Human | Droid | Starship

Example from typescript:

declare type numOrString = string | number

Last updated June 22nd, 2020

Edit Union Types on GitHub