-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fat arrow doesn't work for async methods #4349
Comments
That's intended. The fat arrow syntax expresses a function that inherits the context from the outer expression. Inside a class declaration, the context is the class itself. I think the syntax for
is wrong, but that should break some old code. assuming async is a decorator function, you may write your code as
so the fat arrow expression is written inside the instance context, that I assume is the one you want to pass along. |
The title of your issue is confusing. This isn’t really an “async method”, it just happens to be that you’re passing a method as an argument to a function named We’re working on true async support in #3757. |
The binding for fat arrow is lost if you wrap class method with some function. I demonstrate it with
async
example, but it's not tied to it, the behaviour will be the same for any other function too.Will produce (note the
this
is lost, actually it's not even lost but completely wrong, theEvents
is used instead ofthis
):It should produce:
The text was updated successfully, but these errors were encountered: