Typescript Examples

typescriptSnippet

Error Classify And Map

Classify errors by type and map to appropriate HTTP status codes with retry decisions for API layers.

typescriptSnippet

File Hash Manifest

Build a sorted SHA-256 manifest of file contents so unchanged inputs can be skipped and integrity verified.

typescriptSnippet

Typed Async Retry Helper

A generic retry helper that preserves the resolved value type, caps attempts, and backs off between failures without losing type information.

typescriptSnippet

Express Rate Limit Redis Store

Apply distributed rate limiting in Express with express-rate-limit backed by a Redis store, keying by user identity and API token.

typescriptSnippet

Generic API Response Envelope

Wrap API payloads in a generic envelope type carrying status, data, and optional error metadata so clients get full inference from a single shape.