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

[no-unused-vars] new v4 false positive: generic type arg used as function parameter list #2449

Closed
mmkal opened this issue Aug 31, 2020 · 1 comment

Comments

@mmkal
Copy link

@mmkal mmkal commented Aug 31, 2020

  • 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/no-unused-vars": [
      "warn",
      { "argsIgnorePattern": "^_", "ignoreRestSiblings": true }
    ]
  }
}
export type F<A extends unknown[]> = (...a: A) => unknown;

Expected Result

No error

Actual Result

Error - 'A' is defined but never used.eslint@typescript-eslint/no-unused-vars

Additional Info

When removing the ... before a, the error is no longer reported (although obviously this is a completely different type - just including this info in case it's helpful). i.e. this is fine:

export type F<A extends unknown[]> = (a: A) => unknown;

Versions

package version
@typescript-eslint/eslint-plugin 4.0.1
@typescript-eslint/parser 4.0.1
TypeScript 4.0.2
ESLint 7.7.0
node 12.17.0
@backbone87
Copy link

@backbone87 backbone87 commented Sep 5, 2020

Just an addition:

import { Foo } from './bar';

export type F<A extends unknown[]> = (...a: Foo<A>) => unknown;

In this example A as well as Foo are reported as unused.

@bradzacher bradzacher self-assigned this Sep 5, 2020
@bradzacher bradzacher added the has pr label Sep 5, 2020
bradzacher added a commit that referenced this issue Sep 5, 2020
Fixes #2449
bradzacher added a commit that referenced this issue Sep 5, 2020
Fixes #2449
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

3 participants