The most useful advanced types describe a relationship that callers already need. A nested promise eventually yields one payload type. Selecting a discriminant removes unrelated union members. A route prefix constrains the strings an API accepts. Selecting one field from several records preserves that field's value type.
These exercises keep the runtime implementation small so you can inspect the type contract directly. Compiler-only assertions call each helper correctly and then try a forbidden operation. They are checked with strict settings, not just syntax transpilation. Runtime tests still matter: a typed route can contain an unescaped slash, a union filter can include the wrong event, and a field extractor can silently reorder rows. Avoid replacing the relationship with any, which makes the negative compiler assertions stop protecting callers.