Introduction

This chapter dives deep into one of the most confusing topics in TypeScript - generics. We’ll start by discussing function types to make sure that you have a solid understanding of them, and then we get into generic functions.

Next, we discuss generic interfaces from two perspectives, Object-Oriented Programming and Functional Programming. Interfaces are the bread and butter of TypeScript, so it’s necessary to look at them from a couple different angles.

Finally, we look at a few more advanced topics. Type argument constraints are a way of setting up some expectations about the type argument of a generic type. The next lesson introduces the concept of type constructors, a theoretical foundation of generic types that will come in handy when discussing more advanced types. Finally, type argument propagation talks about an advanced language feature that helps when typing higher-order generic functions.

Get hands-on with 1200+ tech skills courses.