Skip to content
TypeScript·Advanced·Conceptual·1 min read

How should a default server response be handled?

Short interview answer

Validate the unknown response and explicitly reject unsupported discriminator values. A compile-time exhaustive switch cannot protect against malformed or newer unvalidated payloads.

Key takeaway

Explain the underlying mental model clearly, then support it with a concrete example and its trade-offs.

← Back to Discriminated unions

Related questions