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
constmaybePromise=Math.random() ?Promise.resolve() :1;awaitmaybePromise;// rule does not reportPromise.all([maybePromise]);// rule reportsexport{};
ESLint Config
{"rules":{"@typescript-eslint/await-thenable":"error"}}
tsconfig
{"compilerOptions": {"strictNullChecks":true }}
Expected Result
The rule should not report.
Actual Result
The rule reports on passingmaybePromise
intoPromise.all
.
Additional Info
In#11267,@ronami added support for non-promise values passed to aggregator methods.
However, this now introduces an inconsistency:
- The rule correctly doesnot report when
await
ing something that might be aPromise
. - However, the rule wrongly reports when passing something that might be a
Promise
into a promise aggregator function.