← TypeScript learning pathTypeScript · Module 8 of 10
Utility types and enums
Use built-in helpers to transform types.
📖 Key ideas
- Partial<T> makes all properties optional.
- Required<T>, Readonly<T>, Pick<T, K>, Omit<T, K>.
- Record<K, V> builds object types.
- ReturnType<typeof fn> gets a function's return type.
- Enums name constants; union of literals is often simpler.
💡 Real-life example: Utility types are cookie cutters: reshape an existing dough (type) instead of making a new one.
PartialAll properties optional
PickKeep chosen properties
OmitRemove chosen properties
enumNamed set of constants