News for hackers. Stuff that matters.
Re:I Avoid Async/Await by eurasiantiger on Saturday April 16, 2022 @11:14AM (#31052947)
IIRC that doesn’t actually happen if a native Promise is returned.
Re:I Avoid Async/Await by eyelidlessness on Saturday April 16, 2022 @12:33PM (#31053727)
It does, but only if you also add a redundant await. Which I still do, even in TypeScript, unless there’s a compelling performance reason not to. I disagree with the article overall, but I do agree that making asynchrony as explicit as possible is a good idea. Otherwise you end up with code like:

  async function foo(bar) {
    // ...
  }

  function nonObviousAsyncFn() {
    // ...
    return foo(quux);
  }
Explicit return types would help, but most people don’t write them unless they’re forced by a linter.
Re:I Avoid Async/Await by Aeolun on Sunday April 17, 2022 @06:13AM (#31059806)
This would still return a promise for both functions. My IDE at least is really obvious about what happens.
Re:I Avoid Async/Await by eurasiantiger on Sunday April 17, 2022 @03:24AM (#31059155)
Yes, this is a common anti-pattern

    return await foo();