Apia saysTypeScript adds static types to JavaScript, catching bugs before the code runs.
TypeScript is a superset of JS that adds optional type annotations (let n: number, interfaces, generics). A compiler checks types and strips them to plain JS. It catches typos, wrong shapes, and bad refactors at author time, and powers rich editor autocomplete. The cost is a build step and learning the type system — worth it on any non-trivial codebase.
Power-ups you unlock
Superset of JS with optional static types
Compiler checks then strips to plain JS
Catches bugs + powers autocomplete
Cost: a build step and type-system learning
Legacy Larry attacks — common mistakes
Using any everywhere (defeats the point)
Skipping types on public APIs
Fighting the compiler instead of modeling data
Boss battleAnnotate a function’s parameters and return type in your head; note the bug TS would catch.
Example code
<!doctype html><html><head><meta charset="utf-8"></head>
<body style="background:#06040d;color:#e6e0ff;font-family:monospace;padding:20px"><pre>// TypeScript
function add(a: number, b: number): number {
return a + b;
}
add(2, '3'); // ❌ compile error caught before running</pre></body></html>