Skip to content

Commit

Permalink
update promises
Browse files Browse the repository at this point in the history
  • Loading branch information
Tanujkanti4441 committed May 8, 2024
1 parent 84fafeb commit d41d451
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/src/rules/no-return-await.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ further_reading:
- https://jakearchibald.com/2017/await-vs-return-vs-return-await/
---

This rule was **deprecated** in ESLint v8.46.0 with no replacement. The original intent of this rule was to discourage the use of `return await`, to avoid an extra microtask. However, due to the fact that JavaScript now handles native `Promises` differently, there is no longer an extra microtask. More technical information can be found in [this V8 blog entry](https://v8.dev/blog/fast-async).
This rule was **deprecated** in ESLint v8.46.0 with no replacement. The original intent of this rule was to discourage the use of `return await`, to avoid an extra microtask. However, due to the fact that JavaScript now handles native `Promise`s differently, there is no longer an extra microtask. More technical information can be found in [this V8 blog entry](https://v8.dev/blog/fast-async).

Using `return await` inside an `async function` keeps the current function in the call stack until the Promise that is being awaited has resolved, at the cost of an extra microtask before resolving the outer Promise. `return await` can also be used in a try/catch statement to catch errors from another function that returns a Promise.

Expand Down

0 comments on commit d41d451

Please sign in to comment.