
Stop Reaching for any: Narrowing unknown in TypeScript
Why unknown is the type-safe replacement for any, and the narrowing patterns that make it practical in real code.
Tags
67 articles · Page 1 of 6

Why unknown is the type-safe replacement for any, and the narrowing patterns that make it practical in real code.

How to design and implement idempotency keys so retried requests never double-charge, double-send, or double-create resources.

Why most async TypeScript code ignores cancellation entirely, and how to build composable, leak-free cancellation with AbortController.

Use TypeScript template literal types to encode event names, route patterns and permission sets in the type system — no runtime checks, no string drift.

How to add fields, rename properties, and restructure events in async systems without coordinating deployments or silently breaking downstream consumers.

When a cache entry expires under load, dozens of requests race to rebuild it — inflight deduplication collapses that stampede into one upstream call.

Postgres has a powerful built-in full-text search engine using tsvector, tsquery, and GIN indexes — no Elasticsearch cluster required for most applications.

Stop loading entire result sets into memory: how Node.js streams and async generators let you process millions of records without blowing the heap.

Stop racing conditions in distributed systems: a practical guide to implementing distributed locks with Redis and PostgreSQL advisory locks in Node.js.

The satisfies operator validates that a value matches a type while preserving literal inference — why that distinction matters and where to apply it.

Replace Node's stringly-typed EventEmitter with a generic typed alternative that catches event name typos and payload mismatches at compile time.

Why job queues and database state machines break on complex multi-step processes, and how durable execution with Temporal survives crashes and deployments.