I was reading a related post here on return await vs return and someone linked the ESLint rule: https://github.com/eslint/eslint/blob/master/docs/rules/no-return-await.mdNow i understand the whole wanting to try/catch etc and that's not what this is about - I was curious as to this note from ESLint:This is a no:async function foo() { return await bar(); } This is a yes:async function foo() { const x = await bar(); return x; } That' the first I hear about these being different - any idea why? This is clearly not about the try catch since neither statement has one. Id imagine this is a stack trace thing though I haven't personally seen it as an issue. Anyone experience the diff with this?
Submitted September 05, 2020 at 03:48AM by nullanomaly
No comments:
Post a Comment