Diagnostics

LUM1007: await using in a component

A component body uses await using.

Severity: error · Category: file format (1xxx)

Reported by: the compiler.

#What it means

The compiler rewrites component-level await to restore the owner, context and tracking after each await. await using (explicit resource management) needs disposal at scope exit, which this rewrite does not support in v1.

#Example

tsx
export async function Report() {
  await using db = await openConnection();
  return <p>{await db.count()}</p>;
}

#How to fix it

Acquire and release the resource inside a helper function, which the rewrite leaves alone, and await that:

tsx
async function loadCount() {
  await using db = await openConnection();
  return db.count();
}

export async function Report() {
  const count = await loadCount();
  return <p>{count}</p>;
}