indexed access type

A type written T[K] that looks up the type of property K on type T, such as UserEntity["email"] giving string.

In more detail

Combined with keyof it returns the exact type of whichever property was requested. typeof routes[0]["path"] reads a type out of a value the same way.

Example

function getProperty<T, K extends keyof T>(obj: T, key: K): T[K]

Related terms

Taught in

References