Type Theory in Programming Languages
What a type system actually does — from preventing bugs at compile time to enabling expressive polymorphism — and why type theory underpins modern language design.

Type theory is the formal study of assigning types — classifications of values — to program expressions, and checking that programs use values consistently with their types. In practice, a type system is a compile-time (or runtime) proof checker that every operation is applied to a sensible operand: you cannot concatenate an integer with a list, because no rule licenses it.
What types buy you
Types prevent whole classes of bugs at the earliest possible moment. A well-designed type system rejects "calling a method that does not exist," "passing a string where a number is required," and "forgetting to handle the null case" — not by testing, but by construction. This is why statically typed languages (Rust, Haskell, TypeScript, modern Java) catch whole classes of errors before the program runs, while dynamically typed languages catch them when the code runs. The engine's TypeError is the validation you would otherwise hand-write.
The expressive ladder
Simple types (integers, strings) barely scratch it. Sum types ("this is either A or B") encode absence and alternatives; parametric polymorphism writes one function valid for all types; dependent types let types depend on values, so a function's type can prove properties like "the returned list has the same length as the input." Modern languages increasingly borrow these ideas: Rust's ownership system is type-theoretic memory discipline; TypeScript's type system is deliberately Turing-complete in its expressiveness. Rust ownership and borrowing is a practical application of a type system to memory safety without a garbage collector.
The type-theoretic view
Under the Curry–Howard correspondence, propositions are types and proofs are programs: a program of type A → B is a proof of an implication. This is not a metaphor but a formal correspondence that underlies proof assistants (Coq, Lean) and explains why type systems are the sharpest tool for expressing program invariants — the type checker is the validation you were about to hand-write in the first lines of every function.
Tags
compilers programming software engineering type theory