The property decorators

The official TypeScript decorators proposal defines a method property as follows:

A property decorator function is a function that accepts two arguments: The object that owns the property and the key for the property (a string or a symbol). A property decorator does not return.                                                                         —Ron Buckton, Decorators Proposal - TypeScript

The following type declares the signature of a property decorator:

declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void; 
Please note that this signature is subject to change in future releases of TypeScript. Please refer to the lib.d.ts file in the TypeScript source code at https://github.com/Microsoft/TypeScript/blob/master/lib/lib.d.ts ...

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.