Discriminated unions for variant data
When objects come in shapes, give each shape a literal tag. TypeScript narrows on the tag, so each branch only sees the fields that exist.
satisfies + as const for config
satisfies validates an object against a type without widening it, and as const keeps literal values. Together they give you both type-checking and precise inferred types — perfect for registries.
Exhaustive switches
Return from every case and let the function's return type do the work. When a new variant is added, the compiler points at every switch that must handle it.
Generic components
A generic prop type lets one component stay strictly typed for any set of values — the caller's literal union flows into onValueChange.