February 2019
Beginner
694 pages
18h 4m
English
The final type of decorator that we will cover are parameter decorators. Parameter decorators are used to decorate the parameters of a particular method. As an example, consider the following code:
function parameterDec( target: any,
methodName : string,
parameterIndex: number) {
console.log(`target: ${target}`);
console.log(`methodName : ${methodName}`);
console.log(`parameterIndex : ${parameterIndex}`);
}
Here, we have defined a function named parameterDec, with three arguments. The target argument will contain the class prototype, as we have seen before. The methodName argument will contain the name of the method that contains the parameter, and the parameterIndex argument will contain the index of the parameter. ...
Read now
Unlock full access