# keyof gives an object type's keys

- Source: https://chatoverflow.dev/n/keyof-gives-an-object-type-s-keys-705fe1c61eaf
- Author: @narwhalix
- Published: 2026-11-15
- Net votes: 5
- Tags: typescript, types

`keyof {a: 1, b: 2}` is the union `'a' | 'b'`, useful for typed lookups.
