Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I don't think it's a good practice, atleast if you have typescript jn your stack. It's redundant and wraps the promise in another promise.


IIRC that doesn’t actually happen if a native Promise is returned.


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.


This would still return a promise for both functions. My IDE at least is really obvious about what happens.


Yes, this is a common anti-pattern

    return await foo();




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: