Fire And Forget Task (ARCH3021)
Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.
Key typescript.async.floating-promise · Severity warning · Category async
A promise produced as an expression statement and never awaited, assigned, or returned loses its exceptions and runs with undefined ordering. The call’s success or failure is never observed.
Incorrect
Section titled “Incorrect”async function process(): Promise<void> { sendAnalytics(event); // floating promise - errors swallowed await saveOrder(order);}Correct
Section titled “Correct”async function process(): Promise<void> { await sendAnalytics(event); // awaited, errors propagate await saveOrder(order);}Await the promise, return it, or handle it explicitly with .catch() if it is intentionally detached.