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

Can a boolean be a discriminator?

Short interview answer

A true or false literal can discriminate two members, but descriptive string literals usually scale and communicate domain meaning better as more states appear.

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