Unions and Intersections in Typescript. A simple topic, right? That's what I thought until I started noticing several conflicting explanations. So I dug in to find the answers myself.
Typescript type challenges: https://github.com/type-challenges/type-challenges
Iván Ovejero, I have no idea who you are, but thank you for your presentation, which put me on the right trail:
https://www.youtube.com/watch?v=JiLoWPwhTf0&ab_channel=Prisma
Timecodes
0:00 - Intro
0:32 - The confusion
1:10 - Type Theory: Wikipedia deep dive
3:21 - Sum and Product Type
4:10 - "Union" code example
7:10 - "User Land" and "Type Land"
9:44 - It's not OR, it's BOTH
11:24 - Narrowing the type
12:58 - What about intersections?
14:12 - The inverse relationship
16:37 - We're all going to die