A pull request goes up with a two-line change: someone adds as any to silence a red squiggle under an API response. CI is green, the review passes, the branch merges. Three weeks later a customer's invoice shows a plan name of undefined, and the person debugging it spends an afternoon following the value back through four files to that one cast. The type checker was never wrong. It was switched off at the exact point where it mattered.
That story is the whole reason to learn TypeScript properly rather than picking it up by pattern-matching on Stack Overflow answers. The language is not hard to start — you can add a tsconfig.json to a JavaScript project in ten minutes. The hard part is the set of beliefs you accumulate in the first month, because most of them are almost true, which is what makes them expensive.
Below are five of the most common ones, each broken down the same way: what people believe, where the belief comes from, and what it costs when it meets a real codebase.
Myth 1: "any is just a temporary escape hatch"
What people believe
That sprinkling any to get past a stubborn error is a neutral act — you will come back and fix it later.
Where it comes from
It genuinely does remove the error, instantly, and the code still runs. Nothing in the editor tells you that you have just disabled checking for everything downstream.
What it actually costs
any is contagious in a way that is easy to miss. Once a value is any, every property access, every function call and every return value derived from it is also unchecked — the compiler stops reasoning about that branch of your program entirely. A single any at the boundary of an API response can quietly untype a component, a formatter and a test file.
There is a stricter setting, noImplicitAny, on by default under strict, that catches the implicit cases — a parameter with no annotation, a callback whose type cannot be inferred. But it does not catch an explicitly written any, and that is the one people type by hand.
A practical habit that beats willpower: when you reach for any, write unknown instead and let the compiler force you to narrow the value before using it. unknown accepts anything but permits nothing until you check it, which turns a silent hole into a visible, localised task.
any for unknown at the point where external data enters your code — a fetch response, a parsed JSON file, an event payload — and let the errors tell you which checks you actually need. The list is usually short.
Myth 2: "Types protect you at runtime"
What people believe
That a function annotated to receive a User will, in fact, receive a User.
Where it comes from
In a language with runtime type information, that is roughly true. TypeScript's types are erased during compilation — the JavaScript that ships to the browser or to Node.js contains no type annotations at all. The checker is a build-time instrument, not a runtime guard. More on the topic: “Advanced TypeScript: Who Should Take the Advanced Course and Who Shouldn't Waste Their Time”.
What it actually costs
Every value that crosses a boundary the compiler cannot see — HTTP responses, localStorage, environment variables, message queues, third-party SDKs — arrives unchecked no matter what you annotated. This is where a large share of production incidents in typed codebases originate, and it is the exact gap that type guards exist to close.
A guard is a small function whose return type is a type predicate: function isUser(value: unknown): value is User. Inside it you check the shape; outside it, the compiler narrows the variable for you. The discipline is to place guards at the edges of the system — where data enters — and trust the types everywhere inside.
People who skip this step often discover the problem in the worst place: a Cannot read properties of undefined error in a component that "couldn't possibly" receive bad data, because the annotation said so.
Myth 3: "interface and type are the same thing"
What people believe
That the choice between them is stylistic, so teams argue about it the way they argue about semicolons.
Where it comes from
For the simple case — describing an object with a few fields — they behave identically, and the first tutorial you read picked one arbitrarily.
What actually costs you
They diverge in ways that matter once a codebase grows:
- Declaration merging. Two
interfacedeclarations with the same name in the same scope merge into one. That is how library authors let consumers extend their types — and how a duplicate name in your own code silently produces a type with fields you did not intend.typethrows an error instead. - What they can express. A
typealias can name a union, a tuple, a primitive or a mapped type; aninterfacedescribes an object shape. If you ever need `type Status = 'idle'
| 'loading' | 'done', that is atype` by necessity.
- Error messages. When a type is wrong, the compiler's message about an interface is often easier to read; with deeply composed type aliases you sometimes get a wall of expanded structure.
A working convention many teams settle on: interface for public object shapes that others may extend, type for everything else — unions, function signatures, aliases of utility types. The rule matters less than picking one and applying it consistently, because inconsistency is what makes a codebase hard to read six months in.
Myth 4: "Generics are for library authors"
What people believe
That <T> belongs in the realm of people writing frameworks, and that application code can get by with concrete types.
Where it comes from
Generic signatures in library documentation look intimidating, and the first attempts at writing one often produce an error message nobody can parse.
What it actually costs
Without generics you end up either duplicating functions per type or falling back to any — which drags you straight back into Myth 1. Consider a small utility that wraps an API call and returns { data, error }. Written without generics it returns any data and every caller is on its own. Written with one type parameter it returns exactly what the caller asked for, and the compiler tracks it through the rest of the chain.
The step most people miss is constraints. function first<T>(items: T[]): T is fine; function pluck<T, K extends keyof T>(obj: T, key: K): T[K] is where generics start paying for themselves, because K extends keyof T prevents you from passing a key that does not exist on the object — a class of bug that in plain JavaScript surfaces as undefined at runtime.
If you have ever written the same helper twice because the types did not line up, that is the signal to learn generics, not to reach for a cast.
- The error disappears immediately
- The value stays unchecked downstream
- Failures surface at runtime, far from the cause
- Every caller inherits the blind spot
- You write a short shape check once
- The compiler narrows the value for callers
- Bad data is caught where it enters
- The check is testable in isolation
Myth 5: "You migrate a JavaScript project by renaming files to .ts"
What people believe
That the migration is a mechanical rename, followed by fixing whatever turns red.
Where it comes from
It is literally the first instruction in most migration guides, and for a tiny project it works.
What it actually costs
On a real codebase, flipping the extension on everything at once produces hundreds of errors simultaneously, and the team's response is predictable: a wave of any and @ts-ignore comments to get the build green again. You end up with a TypeScript project that checks almost nothing — the worst of both worlds, since you now maintain annotations that provide no safety.
The approach that survives contact with a deadline is incremental, and the compiler has a setting built for it: allowJs. You keep .js files compiling alongside .ts ones, add checkJs when you want the checker to look at JavaScript too, and convert file by file starting from the leaves — utilities, formatters, pure functions — rather than from the entry point. Each converted file is a small, reviewable pull request, and the type information flows outward from the files that are already typed.
Two settings shape how painful this is. strict turns on a family of checks at once, including strictNullChecks, which is the one that catches the largest share of real bugs — and also the one that produces the most errors on legacy code. Turning strict on from day one of a migration is a decision about your team's next month, not a technicality. Many teams enable it on new code first (through a separate config for a new directory) and widen the scope as files get converted.
| Setting | What it changes | When it hurts |
|---|---|---|
strict |
Enables the full family of strict checks, including strictNullChecks |
Legacy code explodes with errors on day one |
allowJs |
Lets .js and .ts files coexist in one project |
Nothing — it is the enabler for incremental migration |
checkJs |
Runs the checker on JavaScript files too | Surfaces errors in code nobody is ready to fix yet |
noEmit |
Type-checks without producing output | Only if you expected the compiler to build your bundle |
That last row is a common early stumble: people expect tsc to produce their application bundle. It does not — it type-checks and, depending on configuration, transpiles. Bundling is the job of a separate tool. Confusing the two leads to a build setup that seems to work until it does not.
What actually separates people who "know TypeScript" from people who use it
The dividing line is rarely syntax. It is judgement about where types earn their keep: at the boundaries of the system, in the shape of shared data, and in the signatures of functions other people call. Inside a twenty-line function, elaborate type gymnastics often cost more in readability than they save in bugs.
This is also why the language rewards a specific learning order. Basic types and narrowing come first because everything else is built on them. Generics come next because they are how you avoid duplication without any. Conditional and mapped types come later, and mostly matter if you are writing shared utilities or working with a library's type definitions — they are powerful and easy to over-apply, and a codebase full of clever conditional types is a codebase nobody wants to debug.
Where does the rest of the stack fit? TypeScript in a React project is a different exercise from TypeScript on a Node.js server. On the frontend the hard problems are props, state and event handlers; on the backend they are request and response shapes, middleware, and the boundary with the database. If React is where you will spend your time, the frontend-specific traps are worth reading about separately. More on the topic: "React — Modern Frontend: What to Know Before You Start and Where Even Experienced Developers Stumble".
Three ways to learn it, and what each one costs you
There is no single right answer here, but the trade-offs are real and worth naming honestly.
Self-study from documentation and blog posts. Cheapest in money, most expensive in time and in the wrong turns you take. The failure mode is not learning wrong syntax — it is learning a habit wrong. Someone who spends three months writing any because nobody told them otherwise has to unlearn it later, and unlearning is slower than learning.
Learning on the job, converting an existing project. Excellent for motivation, because the code is real and the problems are yours. The catch is that a migration under deadline pressure pushes people toward the fastest fix, and the fastest fix is usually a cast. You can come out the other side with a .ts codebase and JavaScript-level confidence.
A structured course with feedback. You pay in money and get something the other two paths cannot give you: someone (or something) checking your decisions rather than just your output. The value is highest exactly where self-study is weakest — the judgement calls about where to put a boundary, when a generic is worth it, and whether a type is doing work or just decorating.
A structured path makes the most difference for people who already write JavaScript and are moving into a typed codebase, and for developers preparing for interviews where TypeScript questions are now standard rather than a bonus. It matters less for someone who has never written JavaScript at all — the language underneath is the foundation, and skipping it makes the type system feel arbitrary.
any anywhere. If you can do it in ten minutes, you are further along than most. If you cannot, you have found the exact thing to learn next.
On asibiont.com the TypeScript material is text-based and personalised: the starting modules set the base, and the lessons after them adapt to how you handle the tasks, going deeper where you score well and reinforcing the fundamentals where you do not. An AI tutor is available for questions on the topic, which is the closest thing to having someone look over your shoulder when you are deciding between a cast and a guard.
If you are already using AI assistants to write or review TypeScript, there is a related skill worth building: specifying the constraints up front so the generated code is typed properly instead of loosely. More on the topic: "Twelve Prompts That Turn an LLM Into a Web Dev Lead: JavaScript and TypeScript Workflow From Project Architecture to Deploy".
The one habit to take away
If you remember nothing else from this: types are a boundary tool. Put your effort at the edges — where data enters, where modules meet, where other people call your functions — and let the compiler do the rest. A codebase with modest types at every boundary is safer than one with elaborate types in the middle and any at the doors.
The course walks through exactly these decisions — narrowing, guards, generics with constraints, and a migration path that does not collapse into a wave of casts — and adapts to what you already know, so you are not sitting through the basics you have. Details and enrolment are on the course page: TypeScript — Static Typing for JavaScript. More on the topic: “TypeScript — Static Typing for JavaScript: A Complete TypeScript Course, From Basic Types to Generics and Real Production Code”.