mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-03 07:54:40 +08:00
TS2504 demands a `[Symbol.asyncIterator]()` method that returns an async iterator. In untyped JavaScript, whether a value is async-iterable is a runtime fact of the value rather than a static one, exactly like the sync demand (2488) relaxed just above. `for await` over a non-async-iterable and `yield*` in an async generator both lower through the runtime protocol openers, which read the method, call it, and throw the same TypeError Node throws when it is missing, uncallable, or returns a non-object. Only diagnostics change, so only variants that previously held a 2504 refusal can move: the relaxed set is consulted only when JavaScript strictness is suppressed, and 2504 is the sole code this adds. The sync sibling 2505 stays enforced on the typed lanes, and TypeScript sources keep 2504 because the relaxation applies to `.js`/`.mjs`/`.cjs`/`.jsx` only. Corpus 8423-async-iterator-protocol-shapes.js pins the seven protocol shapes Node rejects and the two it accepts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>