Lesson 2.2
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.
4mIntermediate17.5k students
Overview
What this lesson covers
- Constrain a parameter with extends
- Use keyof to type property access generically
- Give a type parameter a sensible default
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
Your notes will live here soon.