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

How does the in operator narrow optional properties?

Short interview answer

Members with an optional property may remain in both branches because the property can legally be present or absent. The check does not always select one member exclusively.

Key takeaway

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

← Back to Type narrowing

Related questions