Lesson 2.24mIntermediate17.5k students
Constraints and default type parameters
Constraints say what a type parameter must at least be. Combined with keyof, they give you property access that stays typed.
This lesson sits in Generics, part of TypeScript for Application Developers. It assumes what came before it and leads directly into the next lesson in the module.
In this lesson you will
- Constrain a parameter with extends
- Use keyof to type property access generically
- Give a type parameter a sensible default
Resources
Your notes for this lesson will appear here.