How mapped types work
A mapped type transforms one type into another by iterating its properties:
type LowercaseKeys<T> = {
[P in keyof T as Lowercase<P>]: T[P];
};
The as clause lets you rename keys during mapping. Combined with modifiers like readonly/?, mapped types express a huge range of derived shapes.
Conditional types
Conditional types choose between two shapes:
type IsString<T> = T extends string ? true : false;
type A = IsString<"x">; // true
type B = IsString<42>; // false
T extends U ? X : Y is like a ternary for types. They power advanced helpers and can be distributed over unions when used over a naked type parameter.