Lately, I made a change in my app to transition from compiling async functions to simply using the regular async syntax. However, I've encountered an issue where I'm receiving an error message
Expression is of type asyncfunction, not function
from FB.
sdk functions. For instance, when I try to call FB.login(async () => {})
, it triggers this exception. This has led me to ponder whether we can:
- 1 - restrict async expressions (?) statically (perhaps with Typescript) for the FB object
- 2 - persuade Facebook to avoid unnecessary complications. The application shouldn't be concerned with distinguishing between a function expression and an async function expression (or any other types we might introduce).
Please note: My current workaround involves wrapping the function like so
FB.login((data) => (async () => {...}))
and including a comment explaining the reason behind this action. Nevertheless, this approach is quite delicate as there may be instances in the codebase where these functions are called without awareness of the underlying issue.