Unawaited promise
The work was started and nobody waited for it.
What it looks like
- A missing
awaiton a call whose result is not used. array.map(async …)passed somewhere expecting values rather than promises.- A
forEachwith an async callback.
Why it survives review
Nothing about the line looks wrong, and TypeScript will often not complain when the result is discarded. The function returns promptly and correctly; the write it was supposed to perform lands a moment later, or not at all, and its failure becomes an unhandled rejection somewhere with no stack trace worth reading.
How to see it
- Read every call in an async function and ask whether it returns a promise. If it does and there is no
await, decide whether that is deliberate. forEachcannot await. Any async callback passed to it is fire-and-forget.- Check what happens to the rejection. Work nobody awaited is work whose failure nobody sees.
A minimal pair
Correct
await saveOrder(order);
return { ok: true };
Defective
saveOrder(order);
return { ok: true };
The response says the order was saved before the save has happened — and if it fails, it says so anyway.
Practise it
No exercise in the corpus sets this class yet. The lesson stands on its own — the corpus grows by adding subjects, and pretending otherwise would hide the gap.