Chapters

  • 0. Introduction

    Free

  • 1. Types & Values

    Free

  • 2. Types are just data

    Free

  • 3. Objects & Records

    Free

  • 4. Arrays & Tuples

    Free

  • 5. Conditional Types
  • 6. Loops with Recursive Types
  • 7. Template Literal Types
  • 8. The Union Type Multiverse
  • 9. Loops with Mapped Types
  • 10. Assignability Quiz
  • 11. Designing Type-Safe APIs
  • 12. Conclusion

Articles

Subscribe

About

Made with ❤️ by @GabrielVergnaud

|Chapters|Articles

Learn how to unleash the full potential of the Turing Complete type system of TypeScript!

Introduction

Type-level TypeScript is an online course to take your TypeScript skills from intermediate to advanced. It will give you a solid understanding of the type system's fundamentals and guide you through its most advanced features. You will find everything you need to become a TypeScript Expert — not only in-depth content, but also fun challenges to practice your new skills, like this one right here.

Let's see if you can solve it!

Challenge
Solution

Congratulation! 🎉

Over the years, the type system of TypeScript has grown from basic type annotations to a large and complex programming language.

If you have ever looked into the code of an open-source library you may have found types that looked intimidating and foreign, like some esoteric language coming from another planet. Library code often needs to be much more abstract than the code we are used to writing; that's why it makes extensive usage of advanced TypeScript features such as Generics, Conditional Types, Mapped Types or even Recursive Types.

I mastered these concepts while working on TS-Pattern, a widely-used open-source library that has the particularity of being extremely hard to type. In this course, I hope to share what I've learned by reading too much source code and tinkering for hundreds of hours with the type system.

Types are awesome.

Not only can good types catch your mistakes and typos, but they also make you more proficient by documenting your code and providing you with smart suggestions. The more your types know about your code, the better they are at helping you!

Once you're fluent in the language of types, everything becomes possible. You will be able to quickly build the abstractions you need, and stop feeling like the type system is getting in your way.

Wish you had a type-safe navigate function that'd make sure your route parameters are correct? Here you go 👇

This isn't magic. The type system is just a real programming language!

To get better at this, you first need to acknowledge that TypeScript's type system is a full-fledged programming language in itself! It's more than worth learning its fundamentals, just like you would with any other new programming language.

Throughout this course, I'll try to show the correspondence between programming concepts you already know like code branching, variable assignment, loops and data structures, and their type-level equivalent.

By assembling these building blocks, you will be able to create powerful type-level algorithms that make sure the abstractions you create are always used properly in your entire codebase.

Let's take your TypeScript skills to the next level!

1

Types & Values

Free

How can we cross the bridge between types and values? Let’s better understand type inference.

👉 Generic functions

👉 Using type parameters

👉 Type-level functions

2

Types are just data

Free

It turns out that types aren’t so different from values. Let’s shift perspective and start seeing types as another form of data.

👉 Primitive & Literal types

👉 unknown & never

👉 The dreaded any

3

Objects & Records

Free

Objects are the most common data structures in TypeScript. Let’s learn how to create and transform object types.

👉 Objects vs Records

👉 Transforming & Merging Objects

👉 Open vs closed objects

👉 The amazing keyof keyword

4

Arrays & Tuples

Free

Let’s take a look at the real arrays of the type-level language: Tuples!

👉 Tuples vs Arrays

👉 Transforming Arrays & Tuples

👉 The power of Variadic Tuples

5

Conditional Types

The type-level programming journey begins! Let's create our first type-level algorithms using Conditional Types for code branching.

👉 The extends keyword

👉 The infer keyword

👉 Type constraints and as const

6

Loops with Recursive Types

Computer are great at repetitive tasks. There is no reason we shouldn't take advantage of their power for types too! Let’s learn how to loop through lists of types using recursion.

👉 Imperative vs Recursive loops

👉 Looping through Tuples

👉 Type-level Map, Filter and Reduce functions

7

Template Literal Types

Did you know TypeScript’s type system can parse strings? Let’s learn how to use Template Literal Types to generate unions of strings, parse them and write type-safe Domain-Specific Languages.

👉 Generating unions of strings

👉 Parsing strings with recursion!

👉 Our first type-safe DSL

8

The Union Type Multiverse

Union types are super common, and yet one of the hardest part of the language to wrap your head around. Let’s deepen our understanding of unions to better predict their behavior in generic code.

👉 The nature of union types

👉 Transforming & filtering unions

👉 Type narrowing

9

Loops with Mapped Types

Most TypeScript code is about transforming objects, so we often end up with many object variants in our codebases. Let’s learn how to generate object types by looping through the keys and values of existing ones.

👉 Looping through objects and tuples

👉 Transforming unions into objects

👉 Dealing with ?: and other property modifiers

👉 Object index signatures

10

Assignability Quiz

Type Assignability is at the core of TypeScript. Let’s explore how it works through the best way I know — playing a game!

👉 readonly types

👉 Assignability of functions

👉 Type variance

👉 Assignability pitfalls

11

Designing Type-Safe APIs

So much of programming is about using the code of other people. Let's learn how to design delightful type-safe interfaces from the best open-source TypeScript libraries!

👉 Custom error messages

👉 Custom autocomplete suggestions

👉 The Type Builder pattern

12

Conclusion

It is time to let you continue your TypeScript journey on your own. Before we say good bye, let's pause to consider how far you've gone, and what you can do next to get the most out of your shiny new TypeScript skills.

👉 Solving real-world problems

👉 Mentoring

👉 Contributing to libraries

Finally, we will discuss the tradeoffs of moving more of your code complexity to the type level. We will talk about compile time performance, type errors, type-level debugging and other challenges of type-level programming. It will help you reflect and take the right decision when using these techniques.

This course isn't a collection of TypeScript tricks! I believe that building a good mental model of the fundamentals is more empowering because it will help you solve problems we haven't covered. Knowing a few tricks can only get you so far, but mastering the building blocks of the language and the way they interact together will enable you to solve your real-world problems.

Don't take my word for it.
David Blass
David Blass
@ssalbdivad
·Follow
Replying to @ssalbdivad

Shoutout to @GabrielVergnaud- I've recommended Type-Level TS to a dozen or so people wanting to learn more complex types and heard nothing but positive feedback 💯 type-level-typescript.com

6:49 PM · Mar 11, 2025
4
Reply
Read more on X
Lucas Genzelis
Lucas Genzelis
@LGenzelis
·Follow

@GabrielVergnaud I can't express how grateful I'm with you for writing type-level-typescript.com. It's without question one of the best courses there's. And the final chapter is pure gold! ^_^

8:44 PM · Dec 17, 2024
9
Reply
Read 1 reply
Már Örlygsson
Már Örlygsson
@maranomynet_en
·Follow

So much recommended: type-level-typescript.com/05-conditional… I'm feeling complicated emotions after reading this installment. Why (WHY!) has no one explained `infer` to me like this before!? For me `infer` has been something I randomly fumble around with until things "work" because … magic?

10:02 AM · Oct 27, 2022
17
Reply
Read 3 replies
Travis Fischer
Travis Fischer
@transitive_bs
·Follow

This is sooooo good. If you're already solid at TS, this will take you to the next level. Bravo

Gabriel Vergnaud
Gabriel Vergnaud
@GabrielVergnaud

SO excited to finally announce... 🔥 Type-Level TypeScript 🔥 The type system of #TypeScript is a *real* programming language. Here is an online course to discover its most advanced features and how to unleash its full potential! 👉 type-level-typescript.com 🎉 Learn more 🧵👇

Watch on X
10:17 AM · Nov 23, 2022
4
Reply
Read more on X
🦋 Frédéric Camblor‏
🦋 Frédéric Camblor‏
@fcamblor
·Follow

I'm using Typescript everyday since almost ~7 years now. And I was struggling with `infer` keyword everytime I was crossing its path. But thanks to @GabrielVergnaud chapter 5 on type-level-typescript.com/05-conditional…, I finally understood how it is working for real. Thanks a lot for that !

11:01 PM · Oct 31, 2022
18
Reply
Read more on X
📦🛠👷🏻‍♂️Sean Larkin
📦🛠👷🏻‍♂️Sean Larkin
@TheLarkInn
·Follow

🚨🔥 Just want to give big endorsement for type-level-typescript.com "<Type>Level TypeScript" by @GabrielVergnaud Spending the money on this course was 1000% worth it and super valuable on my day-to-day work! 😍 Go use your learning budget at work and take this course! 🚨🚨🤯

8:26 PM · Jan 5, 2023
99
Reply
Read 1 reply
Chris Cardoso
Chris Cardoso
@kris_card
·Follow

Type-Level TypeScript is just amazing 🔥💯 type-level-typescript.com Merci beaucoup @GabrielVergnaud #TypeScript

4:45 PM · Sep 30, 2022
10
Reply
Read more on X
Marc Agbanchenou
Marc Agbanchenou
@marcagba
·Follow

💯 worth your money 💰

Gabriel Vergnaud
Gabriel Vergnaud
@GabrielVergnaud

Huge Type-Level TypeScript News: Not one, but TWO new Chapters have been released🎉 nº6 🔥Loops With Recursive Types🔥 & nº7 ✨Template Literal Types✨ You'll learn how to use type-level loops and the `infer` keyword to build functions with super smart type inference! 🧵👇

Watch on X
3:29 PM · Dec 14, 2022
2
Reply
Read more on X
Jeff Posnick
Jeff Posnick
@jeffposnick
·Follow

type-level-typescript.com is very well-done, and helpful if (like me) you came to TypeScript organically, without giving much thought to what the types expressed. Nice work, @GabrielVergnaud! Looking forward to additional chapters.

5:52 PM · Oct 1, 2022
19
Reply
Read more on X
Matías
Matías
@matiasfha
·Follow

This is an amazing learning resource. Go ahead and check the content and be sure to become and early supporter!

Gabriel Vergnaud
Gabriel Vergnaud
@GabrielVergnaud

Huge Type-Level TypeScript News: Not one, but TWO new Chapters have been released🎉 nº6 🔥Loops With Recursive Types🔥 & nº7 ✨Template Literal Types✨ You'll learn how to use type-level loops and the `infer` keyword to build functions with super smart type inference! 🧵👇

Watch on X
9:21 PM · Dec 13, 2022
8
Reply
Read more on X
Miz
Miz
@NSaouli
·Follow

Heavily recommends this course! It'll blow your mind! :)

Gabriel Vergnaud
Gabriel Vergnaud
@GabrielVergnaud

Huge Type-Level TypeScript News: Not one, but TWO new Chapters have been released🎉 nº6 🔥Loops With Recursive Types🔥 & nº7 ✨Template Literal Types✨ You'll learn how to use type-level loops and the `infer` keyword to build functions with super smart type inference! 🧵👇

Watch on X
4:33 PM · Dec 13, 2022
2
Reply
Read more on X
Zubin Khavarian
Zubin Khavarian
@zkMake
·Follow

The "Types are Just Data" chapter of type-level-typescript.com/types-are-just… by @GabrielVergnaud is by far the best mental model I've found to get a foundational understanding of types in TS, especially the difference between "unknown", "never" and "any".

4:48 PM · Jan 6, 2023
14
Reply
Read 1 reply
Baptiste Arnaud 🦋
Baptiste Arnaud 🦋
@baptisteArno
·Follow

Level up your Typescript game with type-level-typescript.com by @GabrielVergnaud That's good stuff 👏

Watch on X
8:46 AM · Nov 24, 2022
13
Reply
Read more on X
Christophe Porteneuve - @porteneuve@piaille.fr
Christophe Porteneuve - @porteneuve@piaille.fr
@porteneuve
·Follow

I rather like @GabrielVergnaud's take on teaching #TypeScript at type-level-typescript.com. This approach works pretty well at making a number of fundamentals "click" that are otherwise often misunderstood. GG Gabriel! Looking forward to the upcoming chapters!

8:16 PM · Oct 12, 2022
17
Reply
Read more on X
Damian Lasecki
Damian Lasecki
@DamianLasecki
·Follow

Like a month ago, I shared this course with my team at an internal lightning talk, adding that this is so good that it could be paid for. 🙃 So I am not surprised at all that the newest chapters require a subscription. Honestly recommend type-level-typescript.com 🚀@GabrielVergnaud

8:13 PM · Dec 28, 2022
3
Reply
Read more on X
Nikos Kleidis 🦋
Nikos Kleidis 🦋
@nikoskleidis
·Follow

I definitely recommend this course if you are working with TypeScript! The instructor takes you step by step and you don't realize when complex code finally becomes understandable!

Gabriel Vergnaud
Gabriel Vergnaud
@GabrielVergnaud

type-level-typescript.com

10:05 PM · Mar 11, 2023
11
Reply
Read more on X

Let's get started!

Enroll in Type-Level TypeScript!

Get access to all chapters of the Type-Level TypeScript course and join a community of 1600+ students!

You will find everything you need to become a TypeScript Expert — 12 chapters of in-depth, unique content, and more than 70 fun challenges to practice your new skills.

  • Full access to all 12 chapters

  • 70 type challenges with explanations

  • Lifetime access to all course materials

  • Exclusive discord community

Loading...

Next ⟹

1. Types & Values

Free