Wrapping it up with Decorators
summary
Covers concrete TypeScript decorator code: a method wrapper that logs "calling <class> <method> with <args>", use of descriptor to replace the method and call apply, a read-only decorator that makes writable false and produces a TypeError when reassigned, and a decorator factory that toggles enumerable for for‑in loops via Object.defineProperty. Explains decorators vs JavaScript proposal (TC39 stage 2) and notes compiled TypeScript differences, with live examples that actually run and fail as shown.
AI-written summary · about
chapters (5)
- 0:00Start
- 4:32Decorator definition
- 10:21Property Descriptor
- 11:44Example: Read-Only Decorator
- 13:10Example: Enumerable Decorator
related talks
48mFalling in love with decorators ES6/TypeScript
32mDemystifying TypeScript Decorators
46mTypeScript Decorators - Higher Order Functions in Disguise
16mDiscover the power of decorators in TypeScript
22mWrapping It Up with Decorators
21mTypescript meta programming from 0 to 100
21mEnhancing Decorators with Type Annotations: Techniques and Best Practices
27mAdvanced TypeScript: elegant solutions to common problems
