Enums vs Union Types in TypeScript Libraries: What You Emit Is the API
Numeric enums, const enums, and string unions: tree-shaking, isolatedModules, and why published .d.ts should usually avoid open-ended enums.
Tag
12 articles · 45 min of reading
Numeric enums, const enums, and string unions: tree-shaking, isolatedModules, and why published .d.ts should usually avoid open-ended enums.
How to stop mixing user IDs and order IDs, when brands beat extra classes, and the limits of compile-time branding at runtime.
How Stripe treats documentation, client libraries, and API design as core infrastructure investments rather than a layer bolted on after the API ships.
Stop hand-maintaining API interfaces that drift from the backend — generate them from OpenAPI and turn breaking changes into compile errors.
Why Netflix moved its API layer from the homegrown Falcor model to federated GraphQL, and built the open-source DGS framework to get there.
A practical framework for versioning APIs and deprecating old versions without breaking clients you don't control or can't even see.
Why Shopify moved its Admin and Storefront APIs from REST to GraphQL as the primary way tens of thousands of apps talk to the platform.
How Stripe layers per-request rate limiting with system-wide load shedding to keep its payments API available when traffic spikes or dependencies slow down.
How request batching and the DataLoader pattern eliminate N+1 query storms in APIs, with a look at when batching helps and when it just adds latency.
Wildcard generics confuse most developers on sight, but the PECS rule turns a wall of question marks into a mechanical, memorable decision.
Stripe's approach to API versioning uses per-account pinned versions and request/response transforms instead of forcing every integration onto the latest shape.
Optional was designed for exactly one purpose: expressive return types. Used anywhere else, it tends to add ceremony without removing any risk.