This decorator is specifically designed for analytics that triggers an event when a Promise is successfully resolved.
class Foo {
@LogEvent("success")
async bar() {
await someAction();
}
}
After researching online, it seems like I need to access the function descriptor to determine if it is asynchronous or not. However, there could be complications with TypeScript marking certain async methods as non-async and it may vary based on which version of EcmaScript is being targeted. Despite these challenges, I believe there must be a reliable solution out there.
What are your thoughts?