Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumTypeScriptassertion functionsSingle-choice MCQ

What does the compiler do with the body of this assertion function, and what is the type of `v` after the call?

function assertIsNumber(x: unknown): asserts x is number { // note: this body never throws } function f(v: unknown) { assertIsNumber(v); return v.toFixed(2); }