The class decorators

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

A class decorator function is a function that accepts a constructor function as its argument, and returns either undefined, the provided constructor function, or a new constructor function. Returning undefined is equivalent to returning the provided constructor function.                                                                                                                                                     – Ron Buckton, Decorators Proposal - TypeScript 

A class decorator is used to modify the constructor of a class in some way. If the class decorator returns undefined, the original constructor remains the same. If the decorator ...

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.