Code Analysis
p-queue: TypeScript Concurrency Control Done Right
Coffee count: 3 - perfectly caffeinated for some TypeScript deep-diving
Today I’m analyzing p-queue, one of those libraries that makes you appreciate when someone solves a hard problem really well. This is Sindre Sorhus’s take on promise queue management with concurrency control, and after digging through its 4,755 lines across 14 files, I can see why it’s become a go-to solution.
What Makes p-queue Special
The README is refreshingly honest - this project is “feature complete” and they’re not planning major new development. Sometimes that’s exactly what you want: a stable, well-designed tool that does one thing exceptionally well.
Ky: A Modern Fetch Wrapper Built for TypeScript and Developer Experience
After three cups of coffee and diving deep into 6,658 lines of TypeScript code, I’ve analyzed Sindre Sorhus’s ky library - a modern HTTP client that promises to be a better fetch. Let me walk you through what I found in the actual implementation.
What Ky Actually Does
Ky is fundamentally a wrapper around the native Fetch API that adds developer-friendly features. From the README, it positions itself as providing “simpler API, method shortcuts, treats non-2xx status codes as errors, retries failed requests, JSON option, timeout support, URL prefix option, instances with custom defaults, hooks, and TypeScript niceties.”