TS1494
TypeScriptERRORNotableSyntaxHIGH confidence

The left-hand side of a 'for...in' statement cannot be an 'await using' decla...

Production Risk

Build will fail; resolve before shipping.

What this means

A syntax error (TS1494): The left-hand side of a 'for...in' statement cannot be an 'await using' declaration.. This diagnostic is emitted by the TypeScript compiler when the left-hand side of a 'for...in' statement cannot be an 'await using' declaration..

Why it happens
  1. 1await used outside an async function, or async/await return type mismatch
How to reproduce

TypeScript compiler reports TS1494 during type checking.

trigger — this will error
trigger — this will error
// Triggers TS1494
// The left-hand side of a 'for...in' statement cannot be an 'await using' declaration.

expected output

error TS1494: The left-hand side of a 'for...in' statement cannot be an 'await using' declaration.

Fix

Add 'async' to the containing function

WHEN Using await outside an async function

Add 'async' to the containing function
// Mark the function as async
async function fetchData() {
  const result = await fetch('/api/data');
  return result.json();
}

Why this works

await can only be used inside async functions; the 'async' keyword makes the function return a Promise.

Sources
Official documentation ↗

TypeScript Compiler Diagnostics

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All TypeScript errors