The Concrete Wins, Not Just the Hype
Why TypeScript
TypeScript adds friction up front and pays it back many times over. The wins are bug prevention, editor support, and refactor safety — at a real cost.
What you'll learn
- Recognize the practical wins
- Understand the real cost
- Decide when to opt in
TypeScript isn’t free — it adds syntax, a build step, and a learning curve. Why do millions of developers use it anyway?
1. Bugs Caught Before Run
function send(user: { email: string }) {
fetch(`/api/send?to=${user.email.toLowerCase()}`);
}
send({ name: "Ada" });
// ~~~~~~~~~~~~~~~
// Argument of type '{ name: string; }' is not assignable to
// parameter of type '{ email: string; }'. In JavaScript, this would have shipped to production — and crashed with “cannot read properties of undefined” the moment a user clicked Send.
2. Autocomplete That Knows Your Code
const user = { name: "Ada", email: "ada@x.com", admin: true };
user.
// ↑ cursor here, editor shows: name, email, admin Free, accurate autocomplete is the single most underrated benefit. You stop guessing field names. You stop opening other files to remember what a function returns.
3. Refactor Safely
Rename a field, change a signature, move a function — the compiler walks every call site and flags what broke. Refactors that would be unsafe in JS become routine in TS.
4. Types ARE The Documentation
function paginate<T>(items: T[], pageSize: number): T[][]; You don’t need a comment explaining the function — the signature tells you what it takes and what it returns. And the docs can’t drift out of date.
5. Confidence at Scale
For projects past ~10k lines, the compile time investment is trivial compared to the time saved on bugs and refactors.
The Costs
Realistic ones:
- Learning curve — generics, conditional types, mapped types take time
- Compile step —
tsc,tsx, or a bundler - More keystrokes — type annotations add code
- Types for libraries —
npm install -D @types/foofor older libs
These costs shrink dramatically once you’re comfortable. The returns compound.
When To Use TS
| Project | TypeScript? |
|---|---|
| A 50-line script | Optional |
| A web app you’ll maintain | Yes |
| A library others will consume | Yes |
| A learning side project | Optional — both work |
| Anything more than 10k lines | Yes |
| A throwaway demo | Whatever’s faster |
The TypeScript ecosystem is now the default for serious JS — Node backends, React apps, Astro sites, library development.
Up Next
The primitives — string, number, boolean, etc.