TypeScript strictNullChecks is the flag that pays

Without it, every type includes null and undefined silently, so the compiler agrees that a possibly-missing value is a string and the runtime disagrees.

// strictNullChecks: false — compiles, throws
function greet(user: User) {
  return user.name.toUpperCase();
}

// strictNullChecks: true — the type has to say so
function greet(user: User | null) {
  if (user === null) return '';
  return user.name.toUpperCase();
}

Turning it on in an existing project produces a large number of errors, and the useful path is to enable it per file with a comment or to fix one directory at a time rather than to attempt the whole codebase. Most of the errors are real: a nullable API response treated as present is the single most common runtime failure in a TypeScript front end. It is the flag that converts TypeScript from documentation into a check.