News for hackers. Stuff that matters.
Re:What’s New in ES2019 by shortercode on Tuesday July 30, 2019 @10:30AM (#20565129)
I know this doesn't match up entirely with what you want syntax wise, but the following works and I consider it quite elegant.

  {
    let row;
    if (row = await db.findOne()) {
      //
    }
    else {
      //
    }
  }
Re:What’s New in ES2019 by ojosilva on Tuesday July 30, 2019 @10:50AM (#20565306)
It's not the same. For instance, you could not use a `const` variable.

Also having "phantom" scope blocks get very nasty to read once you have more involved logic, as the block itself has no implied meaning and the programmer has to walk a few lines into it to get what's going on.

Re:What’s New in ES2019 by jazzyjackson on Tuesday July 30, 2019 @08:54PM (#20570767)
You could always make it a labelled block statement !
Re:What’s New in ES2019 by hombre_fatal on Tuesday July 30, 2019 @02:57PM (#20568006)
Seems like pretty trivial bikeshedding. How about just:

    const user = await db.findOne()
    if (user) ... else ...
Typescript can even narrow the type to null vs. User in each branch block.