Type Checking is the process or tool of verifying that operations on values are valid according to their types.
- It ensures that types are used correctly
- It is a process / tool that validates or verifies types
- It is different from Typing (typing is a property of code or a programming language)
- It is also different from Runtime Validation (e.g., Pydantic), which checks data correctness, not code correctness
Type checking can happen:
- At compile time (before runtime or code execution) → Static Type Checking
- During runtime → Dynamic Type Checking
Static / Dynamic Type Checking / Runtime Validation
All three protect systems at different failure points:
- Static Type Checking → Code (Did I write the code correctly?)
- Runtime Validation → Data (Is the incoming data valid?)
- Dynamic Type Checking → Execution (Can this operation execute right now?)
| Mechanism | What it catches | What it misses | What it provides |
|---|---|---|---|
| Static type checking | Typos, wrong attributes, wrong types in code | Real runtime data | Code-level safety |
| Runtime validation | Invalid external data | Code bugs (typos, logic) | Data-level safety |
| Dynamic type checking | Invalid operations at runtime | Silent logical/data bugs | Runtime execution safety |
