I looking for a way to detect if my function inside the decorator is async or not.
function catchError(target: any, propertyName: string, descriptor: PropertyDescriptor) {
const method = descriptor.value;
if(/* method is async function */) {
}
}
class Foo {
@catchError
public bar(message: string) {
//do somthing
}
}
I tried to looking for option to do that and didn't find anything, maybe there is no way but why?