You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Yes this can cause dangerous bugs in your code. But we've dealt with this problem before and the current strategy is not to handle this because I don't think this is a problem we can solve. We build our predicate functions on behavior of native EcmaScript features specified in EcmaScript specification. We cannot compensate for cases of transpilers like babel transpiling one form of JavaScript code into another form...and even the form of transpiled code changes all the time.
The current strategy that I'm personally using in my project where I need to transpile, is to use common lowest denominator. So if I know I'm targeting envs where Async functions are not supported and they are transpiled into standard function is use isFunction instead.
After doing some research myself, I'm in agreement that supporting Babel-fied code is practically impossible. Writing code in a way that does not requre isAsyncFunction seems to be the best practice.
How about adding a warning to the documentation that states isAsyncFunction's behavior is unreliable in transpiled environments?
Agree, it's almost impossible. This problem easily concerns 40% of our functions, depending what env we want to target with transpilation. You can target even node 0.10.0 with transpilation.
How about adding a warning to the documentation that states isAsyncFunction's behavior is unreliable in transpiled environments?
If a fix is not possible, then I believe that this edge case should be added to the docs.
To Reproduce
async
keyword.isAsyncFunction
on it.isAsyncFunction
again, and noteExpected behavior
isAsyncFunction
works on async functions after transpilation.The text was updated successfully, but these errors were encountered: