-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: [no-misused-promises] versus Promise.finally #10959
Comments
This is indeed unfortunate that the type definitions don't naturally indicate that a provided promise will be handled. I'm +0.1 on reopening/considering a special-case.
@typescript-eslint/triage-team |
Agreed on treating this as a bug and accepting PRs. It is unfortunate that TS can't update the default lib definitions. We normally wouldn't want to hardcode for external types, but the built-in TS ones are under unique restrictions and uniquely refer to built-in constructs. ACK that this is much less common of a pattern. But it's still something folks do, and is a reasonable use case of the code constructs in play. Vote: 👍 from me
All code that this plugin reports on is "100% correct" from a certain point of view. Linting is for the inherently subjective parts of code analysis.
Please paste code blocks rather than screenshots of code. It's hard to copy & paste code from raw images even when they have alt text filled out properly (this one doesn't). await function fn() {
await Promise.reject(3).finally(async () => {
throw new Error('replaced')
})
}
That is incorrect and a little hurtful 😛. #7276 was closed as a technical decision. This issue is requesting to revisit that decision with a new discussion. kirkwaiblinger engaged this issue last week and tagged the team to continue discussion. We're doing what we can to treat this issue & the people in it with respect and hope everyone does the same. |
opening for PRs with resolution being to special-case the behavior around |
Before You File a Bug Report Please Confirm You Have Done The Following...
Playground Link
https://typescript-eslint.io/play/#ts=5.1.6&fileType=.tsx&code=IYZwngdgxgBAZgV2gFwJYHsLwgCgJQwDeAsAFAwzADuwqyMACgE7oC2qIApgHROcBWnKMhwBmPNzioIwADaywOUJFj4YAXgB8RAL54A3GR1A&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6Jge1oFtLlZkiACa1i0Dr0GoMkRNHHRI4MAF8QKoA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA&tokens=false
Repro Code
ESLint Config
tsconfig
Expected Result
OK
Actual Result
Additional Info
This is a request to re-consider #7276.
The issue was closed with reference to the type definition of the
onFinally
callback:However, the type definition is erroneous and Microsoft has declined to fix it.
Based on the type definition, @bradzacher closed the issue because,
But the place in question does handle the promise:
It's unfortunate this problem has come to typescript-eslint from upstream, but please reopen #7276 until a solution can be found.
The text was updated successfully, but these errors were encountered: