Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
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 havesearched for related issues and found none that matched my issue.
- I haveread the FAQ and my problem is not listed.
Playground Link
Repro Code
constasyncIter:AsyncIterable<string>|Iterable<string>=[];forawait(constsofasyncIter){}export{}
ESLint Config
Seeplayground
tsconfig
{"compilerOptions": {// ... }}
Expected Result
If I callfor await
on an iterator that is typed asAsyncIterable<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 theawait
.
Additional Info
No response