Step 4 of 6
Compilers and interpreters
A compiler translates your whole program into machine code before it runs (C, Go, Rust). An interpreter or runtime reads and runs it as it goes (Python, JavaScript in Node or the browser). TypeScript is compiled into JavaScript, and its types vanish at runtime.
Why it matters when you build with AI: TypeScript types do not check data coming from users or APIs at runtime. AI tools often 'fix' a type error with as any, which silences the warning and hides the real bug.
Quick check
Does a TypeScript type check data coming from an API at runtime?
Types vanish at runtime. Validate external data with a schema (e.g. Zod).