Skip to content
Preptima
hardConceptMidSeniorStaff

Where does TypeScript stop protecting you, and what do you do at those points?

TypeScript stops protecting you at runtime boundaries such as JSON, HTTP requests, local storage and third-party packages. Validate untrusted input at the boundary, then let static types carry the trusted shape inside the app. It also connects type soundness to the point an interviewer is testing.

4 min readUpdated 2026-08-15

Answer

Short answer

TypeScript types disappear at runtime, so data from APIs, forms, files and external packages must be parsed or validated before use. After that boundary check, the validated value can safely flow through typed code.

Was this answer helpful?

Likely follow-ups

  • You add noUncheckedIndexedAccess to a mature codebase and get 900 errors. How do you land it?
  • Why is a user-defined type predicate a hole in the type system, and what changed in TypeScript 5.5?
  • Object.keys on a typed object returns string[] rather than the key union. Is that a bug or a decision?
  • How would you type the response of an endpoint you do not control, in a way that fails loudly rather than late?

Related questions

Further reading