Branded Types 7 exercises

Advanced Workshop Welcome

Hello wizards!

Welcome to the Advanced Patterns TypeScript Workshop.

This workshop is inspired by interesting TypeScript stuff I've seen in the wild.

We'll look at actionable patterns that you can use in your code, including:

  • Type Predicates
  • Assertion Functions
  • Branded Types
  • Globals
  • Ex
Loading explainer


0:00 What's up, wizards? Welcome to the Advanced Patterns TypeScript Workshop. This workshop is the place where I've been able to put all of the most advanced, interesting stuff that I've seen in TypeScript in the wild.

0:12 We're going to start diving deep into actionable patterns that you can take, pull out, and put in your application code. We're going to look at type predicates, assertion functions, branded types, globals, external libraries, and a bunch of more stuff. This is going to help you be a better application developer and a better library developer too.

0:28 The way it works, I'll give you a problem, then you try and find the solution, and then I'll show you what my solution was and explain all the steps I take to get there and all the concepts you need to understand. It's like it works in reverse. Instead of me just teaching you and you just sitting there, I'm going to try to get you to solve a problem first, and then when I teach it to you, you'll understand exactly how it's applicable.

0:48 This is a crucial part of learning and understanding something. I've tried to provide you a framework of giving you real-world problems so that you can go and learn the solutions yourself. Each exercise comes with an embedded editor, which you can use on the site or you can clone the repo down and run the scripts yourself.

1:05 There'll be a link to the repository in the text below. You've got all the information you need to get started. Thank you for joining along and enjoy a little bit too.