A discriminated union uses a common literal field to label each variant. A switch on that field narrows to the correct shape in each branch. Use an assertNever helper to force compile-time checks that every case is handled.
function assertNever(x: never): never {
throw new Error("unreachable");
}
Render each case to a short label and keep branches simple.
Render all result variants and ensure the switch is exhaustive.