Fun with Unions in TypeScript

Опубликовано: 03 Июнь 2026
на канале: Nicos Tsourektsidis
548
37

How well do you know unions in TypeScript? Join me in this episode to discover everything you need to know about unions in TypeScript. We will talk about what a union really is, the syntax, and under which circumstances it could be useful. I will show you how to use literal types to create more advanced definitions for your types. We will learn the concept of discriminated unions, and I will show some practical examples to get the most out of them.

Read the article with the coding examples:
https://nicotsou.com/tltr-typescript-...

Contents
00:00 Intro
02:30 What's a union?
05:26 Literal types
07:09 Template Literal types
10:00 Discriminated unions
13:44 Outro

Check out my ✨TypeScript course:
https://tltr-typescript.com

Links mentioned in the video
The playlist:
   • TLTR; TypeScript  
Classes in TypeScript:
   • Master Classes In TypeScript  

This video belongs to my series Too Long To Read TypeScript. Every episode covers in detail a core concept of the language.

❤️ How to support this channel?
Like this video
Subscribe to the channel
Share this video with your friends on social media (only if it helped you)