Engineering notes about typescript
Articles, implementation notes, and lessons from projects involving typescript.
cat ~/writing/typescript
5 postsA User ID Is Not a File ID: Nominal Types in Rust and TypeScriptHow newtypes in Rust and branded types in TypeScript stop values that share a representation from being mixed up, and the small macro I use to make the safe version the easy one.8 min ->I Stopped Handwriting API TypesWhy every frontend I build now gets its API client generated from the backend's OpenAPI schema, and how one source of truth took a whole category of worry off my plate.9 min ->Narrowing Unknown Without Lying to the CompilerA small TypeScript and Zod helper that checks a nested property at runtime and narrows the type from the same dotted path, plus where it breaks and how I use it on third-party responses.14 min ->My Greedy Algorithm Said No. It Was Wrong.A small packing function I wrote for a ledger cleanup job, why its greedy shortcut misses exact answers far more often than I expected, and the short dynamic programming fix.10 min ->Things I Keep Fixing in React CodebasesA short list of habits I end up correcting in almost every Next.js and React project I join: missing keys, requests fired with undefined ids, copy-pasted URL strings, over-shared components, and warnings nobody reads.6 min ->