Falling in love with decorators ES6/TypeScript
summary
Demonstrates concrete decorator code in TypeScript: log decorator that wraps methods and prints args/results, a timer showing a 2.4s run reduced to near 0s after caching, a webworker decorator that offloads prime calculations and returns a promise or observable (works in demo but flagged as non‑production), a media-query decorator for Angular components, and a class decorator that validates constructor arity; notes that decorators transpile at compile time, evaluate bottom‑to‑top, and that bundle size can drop to ~1.2K in the simple example.
AI-written summary · about
chapters (9)
- 0:00Start
- 4:05What decorators is?
- 4:29Disclaimer
- 5:28Proposal
- 7:23Common Use Cases
- 7:42Descriptor
- 10:38Class member Decorator (methods/properties)
- 12:00Signatures of the decorators
- 26:45Class Decorators
related talks
32mDemystifying TypeScript Decorators
46mTypeScript Decorators - Higher Order Functions in Disguise
17mWrapping it up with Decorators
16mDiscover the power of decorators in TypeScript
40mStandardizing JavaScript Decorators in TC39
21mTypescript meta programming from 0 to 100
27mAdvanced TypeScript: elegant solutions to common problems
41mDecorators in Depth
