Skip to content

Bug: [no-unused-vars] fix results in ts error #11843

@jendrikw

Description

@jendrikw

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.9.2&fileType=.tsx&code=FAEwpgxgNghgTmABAcygewEYyog3sRRASwDsAXMOAMxgiQAU40BbIgZzAB4AVAPjwKFEVNGgAUASgBciNmTilkAbkEBfYOuBgAHgAc0cMnkSqlQA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6Jge1tidmUQAmtAG4BDaKgyRE0aB2iRwYAL4hlQA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3QAacDUjxYAEw7oASuhKxUbAsQpQi89EXQAPPJEk0oshRh2RVhk5CkBfEM6A&tokens=false

Repro Code

declare global {
  interface Promise<T> {
    foo(): string;
  }
}

export { };

ESLint Config

module.exports = {
  "rules": {
    "@typescript-eslint/no-unused-vars": "error"
  }
}

tsconfig

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

Expected Result

No warnings

Actual Result

Warning 'T' is defined but never used. 3:21 - 3:22. But when I remove the <T> get an error from typescript: 2428: All declarations of 'Promise' must have identical type parameters. 3:13 - 3:20. Typescript also won't allow you to rename the type parameters to _T.

Additional Info

See also microsoft/TypeScript#62881 and TanStack/table#5222

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginworking as intendedIssues that are closed as they are working as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions