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

[typedef] False positive errors on deep destructuring #4725

Closed
3 tasks done
gultyayev opened this issue Mar 24, 2022 · 3 comments · Fixed by #4958
Closed
3 tasks done

[typedef] False positive errors on deep destructuring #4725

gultyayev opened this issue Mar 24, 2022 · 3 comments · Fixed by #4958
Labels
accepting prs Go ahead, send a pull request that resolves this issue bug Something isn't working good first issue Good for newcomers package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@gultyayev
Copy link
Contributor

gultyayev commented Mar 24, 2022

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have read the FAQ and my problem is not listed.

Repro

{
  "rules": {
    "@typescript-eslint/typedef": [
      "warn",
          {
            "arrayDestructuring": true,
            "arrowParameter": true,
            "memberVariableDeclaration": true,
            "objectDestructuring": true,
            "parameter": true,
            "propertyDeclaration": true,
            "variableDeclaration": true,
            "variableDeclarationIgnoreFunction": true
          }
    ]
  }
}

Playground

Expected Result

Should not print any warnings

Actual Result

Shows a warning (because of that I cannot switch the rule to "error" instead of "warn")

Additional Info

Versions

package version
@typescript-eslint/eslint-plugin ^5.14.0
@typescript-eslint/parser ^5.14.0
TypeScript ~4.5.5
ESLint ^8.11.0
node v16.14.0
@gultyayev gultyayev added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for maintainers to take a look labels Mar 24, 2022
@bradzacher
Copy link
Member

Similar to #4505

@bradzacher bradzacher added accepting prs Go ahead, send a pull request that resolves this issue bug Something isn't working good first issue Good for newcomers and removed triage Waiting for maintainers to take a look labels Mar 25, 2022
@rooby
Copy link

rooby commented Apr 12, 2022

Looking at the pull request for #4505 (#4548) it looks like it was only a fix for objects, however it seems that deep destructuring for arrays is also broken.

For example:

      const [[key, value]]: [string, string][] = Object.entries(someObject);

Gives an error for expected type annotation on the inner array.

@kmin-jeong
Copy link
Contributor

@rooby @gultyaev @bradzacher
I want to solve the issue, so I'm also watching #4505 and palyground with issue.
I understand not only fix for objects but also error for expected type annotation should be considered.
Is there anything else to consider?

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

Successfully merging a pull request may close this issue.

4 participants