Practical introduction to algebraic datatypes (ADTs) in TypeScript

Product types? Sum types? Variants? Unions? …in TypeScript?!

Elias Nygren
ITNEXT
Published in
6 min readAug 10, 2021

--

You might already be using ADTs in your code.

Algebraic DataTypes or ADTs are specific kinds of composite types or combinations of types. The major classes of ADTs are Product types and Sum types. The big deal is that they allow you to express powerful ideas at compile time, using your type…

--

--

Writer for

I’ve been a startup founder (CTO/CEO), freelancer, software engineer and a manager. Previously at Swappie, Europe’s fastest growing scaleup.