Learn how to unleash the full potential of the Turing Complete type system of TypeScript!
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!
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 personally learned these concepts while working on TS-Pattern, an 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 for many reasons:
- They document the code.
- They make developers more proficient by providing them with smart suggestions.
- They catch mistakes and typos.
The more the type system knows about your code, the better it is at helping you! Once you're fluent in the language of types, everything becomes possible. You will no longer feel like the type system restrains your ability to write the abstractions you need.
Want to check if your route parameters are passed correctly? Here you go:
This isn't magic. The type system is just a real programming language!
To get better at this, we 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 we 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!
Types & Values
Similarities and differences between the language of types and the language of values.
Types are just data
Let's take a look at the data structures at our disposal in Type-level TypeScript.
Objects & Records
Learn how to use Object and Record types, two of the most useful data structures of Type-level TypeScript.
Arrays & Tuples
Learn how to create, use, and merge Array and Tuple types.
Let's create our first type-level algorithms using conditional types for code branching! Learn all about the extends and the infer keywords.
Loops with Recursive Types
Learn how to use recursion to loop through types and build powerful type-level algorithms.
Template Literal Types
Learn how to interpolate, parse, and generate unions of string literals.
The Union Type Multiverse
Learn how to transform, filter, and generate other types from union types.
Loops with Mapped Types
Learn how to use Mapped Types to transform Object and Tuple types.
Assignability is omnipresent in TypeScript. Let's explore how it works through the best way I know: playing a game!
Learn how to debug your type errors and type checking performance.
Finally, we will see that moving more of the complexity of your code to the type level is a trade-off that isn't always worth taking. We will talk about compile time performance, type errors, type-level debugging and other challenges of type-level programming. I hope this will help you reflect and take the right decision when using these techniques.
It's worth noting that 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.
Let's get started!
Support Type-Level TypeScript!
Become a Member to support Type-Level TypeScript and get access to all existing and upcoming chapters!
You will find everything you need to become a TypeScript Expert — 11 chapters of in-depth, unique content, and more than 70 fun challenges to practice your new skills.
Full access to all 11 chapters
70 type challenges with explanations
Lifetime access to all course materials
Exclusive discord community