LESSON 2.1
Generic functions and inference
Learn key techniques and workflows in TypeScript for Application Developers.
12m
intermediate
18,683 students
Overview
A type parameter links an input type to an output type. Most of the skill is letting inference do the work rather than annotating call sites.
In this lesson you will:
- Relate argument and return types with a type parameter
- Let inference fill in type arguments at the call site
- Recognise when a generic adds nothing over a union
Pro Tip
Use caching and revalidation wisely to ensure your app stays fast and data remains fresh without unnecessary requests.