Skip to content
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: [use-unknown-in-catch-callback-variable] Does not flag second argument of .then #9056

Open
4 tasks done
RedGuy12 opened this issue May 7, 2024 · 1 comment · May be fixed by #9059
Open
4 tasks done

Bug: [use-unknown-in-catch-callback-variable] Does not flag second argument of .then #9056

RedGuy12 opened this issue May 7, 2024 · 1 comment · May be fixed by #9059
Labels
accepting prs Go ahead, send a pull request that resolves this issue bug Something isn't working package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@RedGuy12
Copy link

RedGuy12 commented May 7, 2024

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

https://typescript-eslint.io/play/#ts=5.3.3&fileType=.tsx&code=AoJw9gtglgzgpgOhHGYA2A3OAKAlAgFwAs4A7bPAAgF4A%2BSgb0oF8AaS7OEcEXG%2Brjz4B6YZUFgQlWJQIBPAA5wAJpQCGMdaTlA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6WZRW2JgayYD2Adya1mtMgEN8ZABYTJ8eACNJZXrQBukqpOVJ0URNGgDokcGAC%2BIK0A&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA&tokens=false

Repro Code

Promise.resolve().then(() => { }, (error) => { })

ESLint Config

module.exports = {
  "rules": {
    "@typescript-eslint/use-unknown-in-catch-callback-variable": "error"
  }
}

tsconfig

{
  "compilerOptions": {
    "strictNullChecks": true
  }
}

Expected Result

I expected an error as error is not explicitly typed as unknown and instead falls back to any.

Actual Result

No error.

Additional Info

No response

@RedGuy12 RedGuy12 added bug Something isn't working package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for maintainers to take a look labels May 7, 2024
@bradzacher bradzacher added accepting prs Go ahead, send a pull request that resolves this issue and removed triage Waiting for maintainers to take a look labels May 7, 2024
@kirkwaiblinger
Copy link
Member

Good spot! I completely spaced on that in the initial implementation 🤣 #8383

The existing rule basically assumes catch throughout, but adding support for .then(f, g) should be quite straightfoward

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepting prs Go ahead, send a pull request that resolves this issue bug Something isn't working package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
3 participants