Skip to main content


Class Decorators

Applied to class constructor for observing, modifying or replacing class definition

class APIServer {
constructor(private app:Express){


// Receives the constructor of the class
declare type ClassDecorator = <TFunction extends Function>(target: TFunction) => TFunction | void;

// Implementation
function log(constructor: Function){
console.log(`${constructor} Decroator Invoked`)

Method Decorators

observing, modifying, or replacing method definition.

class APIServer {


@log("Route added to API Server")
public addRoute(path:string, action:Action){

Property Decorators

Parameter Decorators

Applied to method declaration for observing that a parameter has been defined

Decroator Appraoches

Decrator Function

Must implement specific signatures based on use

Decrator Factory

Enable you to receive parameters and construct the Decorators Need to have paranethsis in their definition.

Decorators are called at runtime with either approach.