Static typing checks program types before execution, usually during compilation. It can catch mistakes such as misspelled field names before the code runs, turning an informal assumption into a checked constraint. section 10.6
Static typing is useful when code relies on names or values that must come from a known set:
- TypeScript can check that field-name strings belong to a known set of valid fields. section 10.6
- Java can use an Enum type, while Haskell can use a discriminated union; the best choice depends on the language and team. section 10.6
- Dynamic typing checks types at run time instead, so the static-versus-dynamic choice involves different trade-offs rather than a settled winner. section 10.8
Checking a field name before execution
Suppose a cart update uses the string "quantitty" instead of "quantity". A static type system can restrict the argument to recognized field names and report the typo before the program runs. Without static typing, a run-time check must validate the name each time the function executes. section 10.6











