How do you make the compiler fail when somebody adds a new variant to a union you switch on?
A TypeScript exhaustive switch uses a discriminated union and a never check so the compiler fails when a new variant is added but not handled. This turns future union growth into a compile-time error. It also connects discriminated unions to the point an interviewer is testing.