Not so much an antipattern as a subtle bug. Another subtle bug is something like:
async function checkSomeCondition() : boolean;
if (checkSomeCondition()) ...;
Because it returned a promise and promises are truthy, the condition is always true! Watch out for this one! It can happen especially when you change a non-async function that is already used somewhere into an async one.
It's worth noting that you can await any value, if it's not a promise, the result is the value itself. For instance:
let x = 123;
console.log(await x);
// prints 123
While awaiting literally every variable is way overkill, you could use this in some cases if you are planning to change to async later in your changeset, because it will continue to work even before you change the function.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Not so much an antipattern as a subtle bug. Another subtle bug is something like:
async function checkSomeCondition() : boolean;
if (checkSomeCondition()) ...;
Because it returned a promise and promises are truthy, the condition is always true! Watch out for this one! It can happen especially when you change a non-async function that is already used somewhere into an async one.
It's worth noting that you can await any value, if it's not a promise, the result is the value itself. For instance:
let x = 123;
console.log(await x);
// prints 123
While awaiting literally every variable is way overkill, you could use this in some cases if you are planning to change to async later in your changeset, because it will continue to work even before you change the function.