Annotations Design Patterns
Design patterns, resilience and caching for TypeScript, with standard TC39 decorators or composable functions. Zero runtime dependencies, strict types and granular imports.
npm install annotations-design-patternsThese docs cover 2.3.0. The migration guide identifies new features and the APIs that retain experimental status.
With decorators
Section titled “With decorators”import { Singleton, Retry, Timeout, Fallback } from 'annotations-design-patterns';
@Singletonclass ApiClient { @Fallback<User[]>([]) @Retry({ attempts: 3, delayMs: 200, backoffFactor: 2 }) @Timeout(5000) async fetchUsers(): Promise<User[]> { /* ... */ }}With functions
Section titled “With functions”import { fallback, retry, timeout } from 'annotations-design-patterns/operators';import { pipe } from 'annotations-design-patterns/pipe';
const fetchUsers = pipe( loadUsers, fallback<object, readonly [], User[]>([]), retry({ attempts: 3, delayMs: 200, backoffFactor: 2 }), timeout(5000),);See the decorator, operator and 2.3 migration guides. The shared API reference has its own symbol search in English; guide search uses the selected language.

