Why static types in Javascript? — Preethi Kasireddy
summary
Argues that adding static types to JavaScript prevents whole classes of runtime bugs (type errors, null exceptions), documents function contracts, and reduces validation and some unit tests while enabling safer refactors. Demonstrates Flow (checker only) and TypeScript (checker + transpiler), shows interfaces, generics, optional properties, discriminated unions, and noImplicitNull. Gives a concrete Coinbase example where typed signatures clarify three-argument payout logic. Notes costs: added verbosity, learning curve, and slower prototyping for short‑lived code.
AI-written summary · about
chapters (11)
- 0:00Introduction
- 1:00Static vs Dynamic Typing
- 3:10JS Typing Tools and Syntax
- 5:51Special TypeScript Types
- 7:25Interfaces and Shapes
- 9:06Type Inference and Aliases
- 11:05Unions and Discriminated Unions
- 13:43Generics in TypeScript
- 15:03Benefits of Static Types
- 21:59Trade-offs and Costs
- 24:06When to Use Static Types
related talks
27mA Story About Types and JavaScript
22mType Systems Will Make You a Better JavaScript Developer
25mStatic types in JavaScript: what, how and why
01h 11mTypeScript: Static types for JavaScript
24mTypeScript: Static types for JavaScript
53m"Strict" JavaScript: Types Versus Reality
28mPractical Confidence: Using Types to Help Your Computer Help You
42mStatic Type Checking with FlowType
