Skip to content
TypeScript

Decorators API Reference

TypeScript decorators — special declarations for annotating classes and their members (experimental).

By EZ4Code Team

Decorators

Experimental decorators (require experimentalDecorators). Stage 3 ECMAScript decorators differ.

@ClassDecorator(target: Function)

Class decorator. Receives the class constructor; can return a replacement class.

Returns: Function | void

@MethodDecorator(target, key, descriptor)

Method decorator. Receives the prototype, method name, and property descriptor.

Returns: PropertyDescriptor | void

@PropertyDecorator(target, key)

Property decorator. Receives the prototype and property name (no descriptor).

Returns: void

@ParameterDecorator(target, key, paramIndex)

Parameter decorator. Receives the prototype, method name, and parameter index.

Returns: void

More TypeScript API References