Also, itโ€™s pointless to use return await outside a try catch. Not sure if the screenshot clipped that part.

Reply to this note

Please Login to reply.

Discussion

It's not completely pointless ๐Ÿ˜…, some linter rules even enforce it.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await#improving_stack_trace

I was following this wisdom: https://jakearchibald.com/2017/await-vs-return-vs-return-await/

Looks like things changed then. So we get better stack traces by using return await huh and the performance penalty of unboxing and boxing the property is negligible nowadays? Thanks for sharing.

I guess if you are writing a game or other perf demanding code, there could be an argument made against the return await. Aleast for me personally I would usually prefer better traces though, debugging async code is already hard enough by itself ๐Ÿ™ˆ๐Ÿ˜‚