Closed
Description
Before You File a Bug Report Please Confirm You Have Done The Following...
- I have tried restarting my IDE and the issue persists.
- I have updated to the latest version of the packages.
- I have searched for related issues and found none that matched my issue.
- I have read the FAQ and my problem is not listed.
Playground Link
Repro Code
const asyncIter: AsyncIterable<string> | Iterable<string> = [];
for await (const s of asyncIter) { }
export { }
ESLint Config
See playground
tsconfig
Expected Result
If I call for await
on an iterator that is typed as AsyncIterable<string> | Iterable<string>
, I expect one of the following to happen:
- No lint error, because the code is arguably correct (
for await
works on both sync and async iterables) - Lint error but no autofix, because the code is arguably ugly (taking a union of sync and async iterables leads to unnecessary promises being created, which is the whole point of this rule), but it's not safe to remove the
await
because that would introduce a code bug.
Actual Result
Lint error, with an unsafe autofix suggesting to remove the await
.
Additional Info
No response