Recently, I delved into the realm of creating decorators and learning how to implement them effectively. One question that came up was whether it's possible to access the arguments of a method within the decorator function.
For instance, I'm interested in developing a decorator that records both the method name and its arguments. However, my current implementation only allows me to retrieve the method name.
export function logger(target, propertyKey) {
console.log(propertyKey); //Method name
}
@logger
private fetchData(param) {
////
}
Is there a way for me to access the "param" argument of the 'fetchData' method from within the decorator?
Thank you in advance.
UPDATE:
Issue resolved. Check out this link to a working example.