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

Why can a generic function still be unsafe internally?

Short interview answer

TypeScript checks the declared relationships, but assertions, any, unchecked indexed access, and inaccurate constraints can violate them. Generic syntax does not replace runtime validation for external data.

Key takeaway

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

← Back to Generics

Related questions