Indexed Access Type
In one line
An indexed access type (T[K]) extracts the type of a property K from type T, enabling type-level property lookup.
In simple words
An indexed access type T[K] gets the type of property K from type T. For interface Person { name: string; age: number }, Person["name"] is string and Person["age"] is number.
This is the type-level equivalent of obj[key] at the value level. Combined with keyof, it enables generic functions that access properties with full type safety.
Indexed access types are used in mapped types, utility types, and generic functions. They are essential for type-level programming — deriving types from other types automatically.
Example
interface User { id: number; name: string; roles: string[]; }
type IdType = User["id"]; // number
type NameType = User["name"]; // string
type RolesType = User["roles"]; // string[]Indexed access types extract the type of each property from the User interface.
Related terms
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.