TypeScript Decorator Patterns
Use TypeScript decorators for clean metaprogramming and cross-cutting concerns.
Usage
Describe the cross-cutting concern you want to implement and get decorator-based solutions.
Examples
- "Create a logging decorator for class methods"
- "Build a caching decorator with TTL support"
- "How do the new TC39 decorators differ from legacy decorators?"
Guidelines
- Cover both legacy (experimentalDecorators) and TC39 stage 3 decorators
- Show decorator factories for configurable decorators
- Include common patterns: logging, caching, validation, retry
- Explain decorator execution order and composition
- Cover reflect-metadata for runtime type information