Blog
Notes on data structures & algorithms, system design, and things I learn along the way.
Learning DSA? Follow the structured path — ordered articles from recursion to dynamic programming.→Types that refer to themselves describe trees, JSON, nested configs and linked lists. How recursive type aliases and interfaces work, building DeepPartial and DeepReadonly, generating every dotted path through an object with template literals, and the compiler limits you'll hit.
strict: true is the baseline, but several useful checks live outside it. What noUncheckedIndexedAccess, exactOptionalPropertyTypes, noImplicitOverride, noImplicitReturns and noFallthroughCasesInSwitch catch — with the real compiler errors — and how to adopt them in an existing codebase.
TypeScript types disappear at runtime, so data from requests, APIs, storage and environment variables is unchecked until you check it. How a Zod schema validates that data, produces the TypeScript type, reports precise errors, and transforms input — and where in an app to put the checks.
Decorators wrap or annotate classes and their members with a reusable function. How TypeScript 5's standard decorators work — what a method decorator receives and returns, evaluation order, addInitializer, decorator factories — and how they differ from the experimentalDecorators that Angular and NestJS were built on.
One function, several call signatures, so the return type follows the argument type. How TypeScript resolves overloads top to bottom, why the implementation signature is invisible to callers, the union-argument trap, and when a generic or a conditional type is the better tool.
If a Dog is an Animal, is a Dog[] an Animal[]? Is a function that handles Dogs a function that handles Animals? Variance answers these questions. What covariant, contravariant and invariant mean, where TypeScript deliberately allows unsafe code, and the in/out annotations that make it explicit.
How TypeScript type-checks code that isn't written in TypeScript: declaration files describe the shape of JavaScript that lives elsewhere. Where they come from — libraries, DefinitelyTyped, your own builds — and how to write one for an untyped module or a global.
TypeScript widens literals by default and enums generate runtime code. How as const preserves exact values, how to derive a union type from one list, and why many teams now prefer const objects over enums.
T extends U ? X : Y lets a type make decisions, and infer lets it pull pieces out of other types. How conditional types work, why they distribute over unions, and how ReturnType, Awaited and Exclude are built from them.
The same backtick syntax as template strings, but for types. How to generate every valid combination of a class name or event handler, type routes and IDs by their shape, rename keys in mapped types, and parse strings with infer.
18 posts tagged TypeScript · page 1 of 2