Promise All Misuse (ARCH3032)
Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.
Key typescript.async.promise-all-misuse · Severity info · Category async
Awaiting independent promises sequentially where Promise.all could parallelize, or using Promise.all where Promise.allSettled is needed to avoid losing results on the first rejection, hurts throughput and correctness.
Incorrect
Section titled “Incorrect”async function load(): Promise<[User, Order[]]> { const user = await fetchUser(); // sequential const orders = await fetchOrders(); // independent but waited return [user, orders];}Correct
Section titled “Correct”async function load(): Promise<[User, Order[]]> { const [user, orders] = await Promise.all([fetchUser(), fetchOrders()]); return [user, orders];}Parallelize independent operations with Promise.all; use Promise.allSettled when you need to collect partial failures.