This category links runtime values to static types using powerful type operators:
keyof – Get all property names as a union:
type User = { id: number; name: string };
type UserKeys = keyof User; // "id" | "name"T[K] – Indexed access to look up property types:
type User = { id: number; name: string };
type IdType = User["id"]; // numbertypeof – Turn a runtime value into a type:
const config = { apiUrl: "...", timeout: 5000 };
type Config = typeof config; // { apiUrl: string; timeout: number }as const – Preserve literal types:
const colors = ['red', 'green', 'blue'] as const;
type Color = typeof colors[number]; // "red" | "green" | "blue"In this category, you'll:
keyof to get property names safelyT[K]typeofas constEach exercise focuses on practical type connections while keeping the runtime code small and clear.