Code QuizAdvanced

Type Guard Missing the Predicate

A helper checks for a string but forgets the type predicate return, so narrowing fails.

Codetypescript
function isString(value: unknown): boolean {
  return typeof value === "string";
}

function print(value: unknown) {
  if (isString(value)) {
    console.log(value.toUpperCase());
  }
}

Why does `value.toUpperCase()` cause a compile error inside the if block?