# Generics: The most intimidating TypeScript feature

> For agents: start with the [agent guide](https://ratstack.sh/llms.txt). Every page is Markdown by default; add `Accept: text/html` for HTML.

[Matt Pocock](https://www.youtube.com/@mattpocockuk) · Published 2023-01-12 · 18:19 · B tier · TypeScript

[Watch on YouTube](https://www.youtube.com/watch?v=dLPgQRbVquo) · [All RatTube videos](/tube)

## Summary

Matt Pocock introduces generics as a way to carry type information through reusable TypeScript code. The examples distinguish generic types from generic functions and show when a constructor needs an explicit type argument.

Later examples combine type helpers and constrain generic inputs. A key lookup uses keyof to keep the selected property tied to its object. A [schema](/lore/schemas-define-the-boundary) example connects the type of supplied data with the schema expected to describe it.

## Section notes

- [0:25](https://www.youtube.com/watch?v=dLPgQRbVquo\&t=25s): Generic types accept type arguments instead of losing information to any.
- [3:20](https://www.youtube.com/watch?v=dLPgQRbVquo\&t=200s): A Set example shows when an explicit element type is useful.
- [6:33](https://www.youtube.com/watch?v=dLPgQRbVquo\&t=393s): Type helpers combine return types and awaited values with constraints.
- [9:49](https://www.youtube.com/watch?v=dLPgQRbVquo\&t=589s): Constraints limit valid inputs to generic functions.
- [13:10](https://www.youtube.com/watch?v=dLPgQRbVquo\&t=790s): A keyof constraint connects an object's keys to its return type.
- [16:30](https://www.youtube.com/watch?v=dLPgQRbVquo\&t=990s): A schema type argument links a schema to its expected data shape.

## Key concepts

- [schema](/lore/schemas-define-the-boundary)

## Our take

Matt Pocock explains generics from the type level up: passing type arguments, inference, and constraints. Effect's types lean on generics heavily, so this pays off quickly.

## Related videos

- [Stop agent slop with Effect |  Mattia Manzati | Effect Milan 2026 🇮🇹](/tube/stop-agent-slop-with-effect-mattia)
- [TypeScript 7 Is Here (And It's 10× Faster)](/tube/typescript-7-ten-times-faster)
- [A 10x Faster TypeScript with Anders Hejlsberg | BRK116](/tube/ten-times-faster-typescript-anders-hejlsberg)
- [Effectifying OpenCode // Kit Langton // Cause & Effect 8](/tube/effectifying-opencode-kit-langton-cause-effect)

Summary based on the transcript. Written 2026-11-15.
