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
asyncfunctionwrapper<T>(value:T){returnawaitvalue;}
ESLint Config
module.exports={"rules":{"@typescript-eslint/await-thenable":"error"}}
tsconfig
{"compilerOptions": {"strictNullChecks":true }}
Expected Result
Theawait value
shouldn't be reported on. We don't know thatT
is or isn't a Promise/Thenable. I'd like to be able to use theawait
just in case it is.
Actual Result
On theawait value
:
Unexpected `await` of a non-Promise (non-"Thenable") value.
Additional Info
For a slightly more realistic reproduction, consider a function thatawait
s the result of calling a function for a generic value:
typeGetSomething<T>=(timestamp:number)=>T;asyncfunctionwrapper<T>(getter:GetSomething<T>){consttimestamp=performance.now();// I'd like to await in here to preserve the call stackreturnawaitgetter(timestamp);}
Somewhat related:#8301, where it was noted that the rule intentionally ignoresany
andunknown
values because there's no guarantee they aren't a Promise.
💖