CodeZettaInterview Hub

TypeScript · Type Guards · Mid-Level · Best Practice

Exhaustiveness checks with never?

Short Interview Answer

In default/switch, assign residual to never to force handling new variants.

Detailed Explanation

Compile-time safety for evolving unions. Pair with discriminants.

Did you know this answer?