TypeScript · Generics and utility types

Indexed access

Looks up the type of a property by key. Combine it with keyof for type-safe helpers.

Syntax
T[K]

Example

Example
type User = { id: string; age: number };
type Age = User["age"];

More in this group

as const Awaited<T> Generic constraint Generic function keyof Parameters<T> Partial<T> Pick<T, K> / Omit<T, K>

Learn this in the course

Reference pages are the quick answer. The course explains the why, shows the full example and ends with a challenge.

Open the course