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
3 tasks done
mmkal opened this issue Aug 31, 2020 · 1 comment · Fixed by #2491
Closed
3 tasks done
Assignees
Labels
bug Something isn't working has pr there is a PR raised to close this package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@mmkal
Copy link

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
@mmkal mmkal added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for maintainers to take a look labels Aug 31, 2020
@bradzacher bradzacher added bug Something isn't working and removed triage Waiting for maintainers to take a look labels Aug 31, 2020
@backbone87
Copy link

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 there is a PR raised to close this label Sep 5, 2020
@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.
Labels
bug Something isn't working has pr there is a PR raised to close this package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants