Ch 5 · The Holes in the Fence · TypeScript
Topic 5 of 6 in TypeScript — Types That Protect Paid Work — 5 lessons.
any Turns the Checker Off
any means "stop checking this value". Every operation on it is permitted, every property access is allowed, and every mistake passes silently. It is the single most common way a TypeScript codebase ends up giving no protection at all while still looking like TypeScript.
unknown Makes You Prove It
unknown also means "I do not know what this is" — but it does not switch the checker off. It refuses every operation until you narrow the value down to something specific. That narrowing is done with plain JavaScript you already know: typeof, Array.isArray, a property check.
strict Is Where the Value Is
TypeScript's checking is adjustable, and with the defaults turned down it catches far less than people assume. The setting that matters is "strict": true in tsconfig.json, which switches on a family of checks — the most valuable being strictNullChecks.
Data From Outside Is Never Typed
This is the most important idea in the whole track, and it is the one most beginners get wrong. Types are erased at build time. That means TypeScript knows nothing about what a server actually sent you at runtime. If you write an interface and tell TypeScript that a network response matches it, you have made a claim, not a check.