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.→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.
Three ways to make a general model work for your problem: change what you ask, change what it can see, or change the model itself. What each one is actually good at, why fine-tuning is the wrong tool for teaching facts, and the order to try them in.
A long model answer can take many seconds to finish, but the first tokens exist almost immediately. How streaming works over server-sent events, how to relay it from your server to the browser, and the details — stop reasons, cancellation, errors — that make it production-ready.
“Respond in JSON” works most of the time, which isn't good enough for software. How schema-constrained generation guarantees the shape of a model's output, how to use it with a Zod schema, and what it still can't guarantee.
A language model doesn't choose words — it produces probabilities, and then something draws from them. How temperature, top-p and top-k reshape that draw, why randomness is useful, and why you can't always count on turning it off.
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.
A type annotation validates a value and then forgets everything specific about it. satisfies validates the value and keeps the precise type TypeScript inferred. When to use it, and how it compares with annotations and as.
any switches type checking off, unknown accepts anything but makes you check before using it, and never is the type with no values at all. What each one is for, and why unknown should replace almost every any you write.
A model trained to predict plausible text will produce plausible text, whether or not it's true. Where hallucinations come from, why they sound so confident, and the practical defences: grounding, letting the model abstain, citations, and verification.
148 posts · page 4 of 15