Articles
Practical, deeply explained engineering writing — free to read, no sign-up required.
All Articles
TypeScript – Classes, Access Modifiers & Abstract Classes
When you build small scripts, plain functions and objects are enough. But as your application grows, keeping data and rules organized becomes difficult. Anyone on your team could accidentally change an important value—like a bank balance or a user ID—and break the system.
TypeScript – Template Literal Types & Pattern Matching
In almost every real-world web application, we rely heavily on strings. We use strings for event names like onClick, API routes like /api/v1/users, and CSS utility classes like bg-blue-500. If you type these as a plain string, a single typo will slip past the compiler and break your app in production.
TypeScript – Mastering Built-In Utility Types
When a TypeScript project grows, developers often end up copying and pasting the same interfaces over and over again. You might have a User interface, a UserUpdate interface with optional fields, and a PublicUser interface without the password. If a field name changes, you have to hunt down and fix five different files.
Generic Constraints & keyof / Indexed Access Types
Generics make your TypeScript functions flexible and reusable. However, a completely open generic like <T> can be too loose. Because TypeScript has no idea what T is, it will not let you safely read properties like .id or .length from it.
TypeScript – Mapped Types & Conditional Types
In real-world applications, copying and pasting interfaces every time you need a slight variation creates a maintenance nightmare. If your User model has ten fields, you should not have to manually write ReadonlyUser, PartialUser, and UserUpdatePayload.
Introduction to Generics – Reusable Type-Safe Code
When you write software, you often need the exact same logic to work on different kinds of data. For example, a function that returns the first item of an array should work whether that array holds numbers, strings, or user objects.
Working with JSON, Third-Party APIs & Declaration Files
TypeScript is great at protecting your code while you write it. However, the moment your app talks to the outside world—like fetching JSON from a third-party API or using an old JavaScript library—TypeScript cannot see what is actually coming in at runtime.
TypeScript – Enums & Const Assertions (as const)
In almost every real-world application, you need to represent a fixed set of values. Think about user roles like Admin and Guest, order statuses like Pending and Shipped, or HTTP status codes. Writing raw strings or magic numbers everywhere in your code leads to typos and hard-to-find bugs.
TypeScript – Type Narrowing & Type Guards
In real-world applications, data does not always arrive in one neat shape. An API response might return a user object or an error message. A function input might accept a string, a number, or null. TypeScript lets us represent these flexible values using union types like string | number.
Union, Intersection & Literal Types
Basic types like string, number, and boolean are great for starting out, but real-world software is rarely that simple. An API response might return data or an error. A configuration flag might only allow three exact words. A database record might need fields from two different shapes combined together.
Interfaces vs. Type Aliases in TypeScript
When you start writing TypeScript, you quickly run into a classic question: should I use interface or type? Both let you describe the shape of an object, and in many cases, they look almost identical.
Functions, Optional Parameters & Overloads
Functions are the backbone of every application. In plain JavaScript, anyone can pass the wrong type of data or forget an argument, and you only find out when the app crashes in production. TypeScript solves this by letting you lock down what goes in and what comes out.