TypeScript Decorators - Higher Order Functions in Disguise
summary
Step‑by‑step demos show how to implement concrete TypeScript decorators that wrap methods rather than change them: a log decorator that captures args, a memoize decorator that caches promise results with an expiresIn option, a loader pattern that toggles an operation flag for a spinner, and a timeout decorator that races a delayed rejection via Promise.race. Examples use Angular components and promise chains, explain decorator factories for configuration, and suggest applying the same patterns to analytics, retries, instrumentation or server code.
AI-written summary · about
chapters (11)
- 0:00Introduction
- 1:30Power of Composition
- 10:00FN arcs
- 17:22Decorators
- 24:28Memoized example
- 28:35Decorators explanation
- 34:58Timeout decorators
- 37:05Example
- 38:34Repetitive Errors
- 39:28Errors with Loader
- 40:20Error Example
related talks
48mFalling in love with decorators ES6/TypeScript
17mWrapping it up with Decorators
32mDemystifying TypeScript Decorators
16mDiscover the power of decorators in TypeScript
27mAdvanced TypeScript: elegant solutions to common problems
21mTypescript meta programming from 0 to 100
01h 05mBusy TypeScript Developer’s Guide to Advanced TypeScript
01h 01mAdvanced TypeScript Type Utilities
