Using Union Types to Improve Your TypeScript Codeby@baransu
508 reads
508 reads

Using Union Types to Improve Your TypeScript Code

by Tomasz Cichociński5mOctober 11th, 2022
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

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.
featured image - Using Union Types to Improve Your TypeScript Code
Tomasz Cichociński HackerNoon profile picture
Tomasz Cichociński

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

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

About Author

Tomasz Cichociński HackerNoon profile picture
Tomasz Cichociński@baransu
I write about TypeScript, React, and Node.js. Exploring real-time rendering and Elixir in spare time.

TOPICS

THIS ARTICLE WAS FEATURED IN...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite
Also published here
L O A D I N G
. . . comments & more!