TSworkingts-evergreen
keyof and indexed access types
Read keys and value types straight off a type.
keyof T gives you the union of a type's property names, and the indexed access T[K] reads the value type stored at those keys — together they let you write lookups that stay correct as the underlying type changes.
keyof as a union of keys
TSintro Press Run to execute
The UserKey[] array accepts only the three literal names keyof User produced, so keys.join(', ') prints id, name, age and count: 3 — adding a field to User would extend the union automatically, with no separate list to update.