The method decorators

The official TypeScript decorator proposal defines a method decorator as follows:

"A method decorator function is a function that accepts three arguments: The object that owns the property, the key for the property (a string or a symbol), and optionally the property descriptor of the property. The function must return either undefined, the provided property descriptor, or a new property descriptor. Returning undefined is equivalent to returning the provided property descriptor".                                                                                  — Ron Buckton, Decorators Proposal - TypeScript

The method decorator is like the class decorator, but it is used to override a method, as opposed to using it to ...

Get Learning TypeScript 2.x - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.