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

How does instanceof narrow values?

Short interview answer

It checks the constructor's runtime instance semantics and narrows to its instance type. Cross-realm objects and customized Symbol.hasInstance behavior can make assumptions fragile.

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