TypeScript·Advanced·Coding·1 min read
What is an assertion function?
Short interview answer
A function returning asserts value is Type can terminate or throw when validation fails, allowing following code to treat the value as the asserted type.
Key takeaway
Explain the underlying mental model clearly, then support it with a concrete example and its trade-offs.