-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Simplify code/examples #731
Comments
Good question! This has been asked before and yes, actually it is deliberate. Internally, we try and avoid this in the library (and there are linter rules configured to discourage this) but the intent is that it's helpful re-enforcing to people that these functions are async and you can consequently do interesting things inside them. The virtue of doing this is debatable, but a primary driver of the documentation is to reduce the amount of support overhead by making it easier for folks to see how they can solve problems they have - as support is where the majority of time is spent by contributors on this project at the moment. |
I would argue, that #897 just proved that this encourages using callbacks over UPDATE. The above mentioned issue's author just confirmed it in their last comment that |
🎉 This issue has been resolved in version 3.2.0-canary.6 🎉 The release is available on: Your semantic-release bot 📦🚀 |
🎉 This issue has been resolved in version 3.3.0-canary.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
I have seen this many places, like this example code:
When defining an async function, the returned value is automatically resolved, meaning one could refactor the above code. (Notice that throwing an Error would probably also feel more natural):
This may be only a personal preference, but I think it would also be easier to parse the code for newcomers. With the rise of "async/await", maybe there is lesser need of using
Promise
s all-together. Any special reason I am unaware for usingPromise.resolve()
everywhere?The text was updated successfully, but these errors were encountered: