"keyof T is the type of T's keys. Once you have it, you can navigate every key relationship in T."
What keyof produces
keyof T evaluates to the union of T's key names as literal types. keyof { id: number; name: string } is 'id' | 'name'. The result is type-layer only; at runtime, you'd use Object.keys() to get the same information as runtime strings.
The union is what makes type-safe key navigation possible. You can constrain a function parameter to K extends keyof T, and the compiler ensures only real keys are passed.
keyof on arrays and tuples
keyof string[] includes both numeric indices and array methods ('length' | 'push' | 'pop' | ... | number). For tuples, the keys are numeric literals for each position plus the same methods. This is occasionally useful but more often surprising — for arrays you usually want T[number] (the element type), not keyof T[].
The keyof + indexed-access pattern
T[keyof T] is the union of all value types in T. { a: number; b: string }[keyof T] evaluates to number | string. This pairing comes up constantly: keyof for names, indexed access for values, both together for 'anything in this object's type.'
keyof is the type-level analog of Object.keys(). It gives you the names of an object's properties — but as types, available at compile time.