TypeScript: The undisputed standard for modern web development
For a long time, I used TypeScript the way I wear a seat belt on an empty street: I knew it was sensible, but I could not say it changed much. I would write an interface, clear two warnings, and move on. For a small project, JavaScript still seemed perfectly adequate.
There was no heroic migration or conference talk that changed my mind. It happened one afternoon when I modified an API response and the editor pointed out every place where my assumption was no longer true. The mistakes were painfully ordinary: a field that might be missing, a new state nobody handled, and a private property that was about to escape through a public response. Exactly the sort of bugs we find late because they are not interesting enough to look dangerous.
That was when TypeScript stopped feeling optional to me. Not because JavaScript had somehow become bad, but because types had become shared context for the compiler, the editor, the tools, and, most importantly, the people working on the code.
Types earn their keep at boundaries
I do not care about putting a type on every possible line. What I want is to look at the edge of a module and understand what goes in, what comes out, and what can fail. An honest signature saves everyone from reconstructing those rules by reading the implementation or asking in Slack.
It also prevents rather boring mistakes. Partial is useful when an operation accepts an incomplete set of changes:
interface Product {
name: string;
price: number;
stock: number;
}
function update(id: string, changes: Partial<Product>) {
// Only the fields that actually changed arrive here.
}
update("prod-123", { price: 29.99 });There is nothing clever about this. That is why I like it. The type explains an everyday operation without making me invent another hierarchy of interfaces.
At public boundaries I am more deliberate. I prefer Pick to Omit when deciding which data may leave the application. With Omit<User, "password">, a sensitive field added next month might slip into the response without anyone revisiting that decision. Pick keeps the allowlist closed:
interface User {
id: string;
name: string;
email: string;
passwordHash: string;
internalNotes: string;
}
type PublicProfile = Pick<User, "id" | "name">;Omit is still handy inside an application. I only distrust it when leaving a field out is a security or contract decision. In that case, I want to declare what is allowed out, not maintain a list of things I hope we remember to hide.
Discriminated unions gave me a similar improvement. Instead of spreading booleans and optional fields across an object, I can represent the states that actually exist:
type Result =
| { status: "loading" }
| { status: "ready"; data: string[] }
| { status: "error"; message: string };
function summary(result: Result) {
switch (result.status) {
case "loading": return "Loading";
case "ready": return `${result.data.length} items`;
case "error": return result.message;
}
}The benefit is not being able to boast that the code is “type-safe.” It is that adding a new state forces me to revisit the places that depend on it. The compiler becomes a surprisingly accurate to-do list.
The compiler does not guard the door
I still run into one tempting misconception: TypeScript does not validate data arriving over the network, from a form, from localStorage, or from a file. Its types disappear during compilation. Declaring that an API returns User does not make the JSON behave.
That is why I treat external data as unknown. any turns off the question; unknown makes me answer it before using the value.
function readName(value: unknown): string | undefined {
if (
typeof value === "object" &&
value !== null &&
"name" in value &&
typeof value.name === "string"
) {
return value.name;
}
}In real code I usually reach for a schema library once the shape gets larger. The particular library is not the point. The boundary is: validate at runtime first, then let TypeScript carry that context through the application. Mixing those two layers produces a very comfortable and very false sense of safety.
The same explicitness helps tools. Editors complete more accurately, refactors find more relevant call sites, and coding agents receive clues that are not buried in vague comments. Still, I do not outsource design to the type system. A huge, badly named interface remains huge and badly named.
Migrating without turning it into a ceremony
I do not believe in rewriting a stable application just to change its file extensions. Dramatic rewrites pile up risk and combine two jobs that are difficult enough on their own: understanding the current system and replacing it. I would rather bring TypeScript into the areas I am already changing.
The allowJs and checkJs options let JavaScript stay in the project while checks are introduced gradually. I can begin with a module that has a clear boundary, add JSDoc where it says something useful, and convert files when the cost makes sense. The product does not need to stop while we declare a new era.
My order is simple: enable checks where changes happen often, remove the any values that conceal important decisions, and leave the rest until I have a concrete reason to touch it. Stricter configuration can follow. Turning on every rule on day one and silencing hundreds of errors with assertions is not progress to me. It only relocates the debt.
There is enough good documentation to avoid guessing: the TypeScript Handbook, the guide to migrating from JavaScript, and the full TSConfig reference.
A small update from the present: when I revisited this note on August 28, 2026, the latest stable release I verified was TypeScript 6.0.3, while TypeScript 7 was still a preview. I could not have known that when the original note was published, and it does not change my argument. Versions matter, but the reason I keep using TypeScript is much less dramatic.
It catches normal mistakes. It makes contracts visible instead of leaving them in somebody's head. It gives useful context to whoever arrives next, whether that is a person or a tool. And I can adopt it gradually without pretending a compiler replaces runtime validation, tests, or judgment.
For me, that is enough.