TypeScript Syntax and Type Operators

Indexed access types — T[K]

An indexed access type selects the declared type of one or more valid property keys. A union of keys yields a union of their value types; T[number] selects an array element type. A missing property key is rejected. Reading an optional property type includes undefined under strict null checking. This type expression does not perform a runtime lookup or check that an array index exists. Example output: "ready". Tested in the strict TypeScript 5.8.3 / ES2022 baseline; the example is not a runtime type validator.

Formal Syntax & Structure

typescript syntaxtypescript
type Id = Ticket["id"];

Working Example

Example Snippettypescript
type Ticket = { id: number; label: string };type Value = Ticket["id" | "label"];const value: Value = "ready";console.log(value);
TypeScript Reference