TypeScript vs JavaScript: Why I Finally Switched for Good

For years I wrote plain JavaScript with the classic excuse: “it’s faster, no setup hassle.” Now, almost every new project I start goes straight to TypeScript, and the actual turning point was one specific incident, not a gradual, neatly planned decision.
It happened on a client project about two years ago — an internal dashboard I built in plain JavaScript because “it’s a small project, doesn’t need TypeScript.” Three months later, a small change landed in the API response — a field that used to be string got changed to string | null by the backend team, without telling me. Nothing broke during development. It only surfaced in production, two weeks after deploy, when a user reported a blank page because the field was null and my code called .toUpperCase() on it without checking first. On TypeScript, that would’ve been a type error caught before I even committed, not a production bug that took two weeks to surface.
Since then, catching errors before runtime hasn’t been an abstract benefit for me — it’s a concrete memory. A typo’d property name, a missed null check, a wrong argument type, all of it surfaces while writing the code, right in the editor, not when a user clicks a button that breaks in production weeks later.
Autocomplete also becomes far more useful once the types are clear. The editor knows exactly what shape of data I’m holding, so I don’t have to keep jumping to a function’s definition in another file or guessing field names from an API response I only glanced at once while debugging yesterday.
Refactoring becomes fearless in a way I didn’t expect beforehand. Rename a field or change an object’s shape, and the compiler immediately points out every place that needs updating — usually as red squiggles across dozens of files at once. Without types, a big refactor is nerve-wracking; I’m always worried one call site got missed, and it usually only surfaces during manual testing that doesn’t always touch every code path.
Types doubling as documentation is a benefit I only appreciated later, not right when I switched. A function signature with clear types is documentation that never goes stale — very different from a comment that’s easy to leave outdated once the implementation changes and nobody remembers to update the comment.
That doesn’t mean plain JavaScript is irrelevant. For a small one-off script, or a prototype that’ll be thrown away in a day just to try an idea, the overhead of writing types isn’t always worth it — I still reach for a loose .js file for quick experiments. But for anything I’ll maintain for more than a week, or anything wired to an external API that could change without me knowing, TypeScript is now the default, not the exception.