Union type is a set of types that are mutually exclusive. The name *union* (or *sum type) comes from type theory. Union types are perfect to express a finite number of known options, either primitive literals or objects. They exist only at type level and are striped out during compilation.
Tomasz Cichociński
@baransu
I write about TypeScript, React, and Node.js. Exploring real-time rendering and Elixir in spare time.
STORY’S CREDIBILITY
Code License
The code in this story is for educational purposes. The readers are solely responsible for whatever they build with it.
Share Your Thoughts