Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Bug: [array-type] rule mistaking a generic type with the actual type because it has the same name (shadowing). #11287

Closed as not planned
@miguel-leon

Description

@miguel-leon

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.8.2&fileType=.ts&code=GYVwdgxgLglg9mABMMAeAggJ0wQwJ6ICmAHlIWACYDOimhOFCANgeANZhwDuYA2gLoA%2BABQ5s%2BAFyIsuPAEpEAbwCwAKES1CUEJiRjZAbjUBfI6qA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6AQ2mncNqNPRREXAPbRI4MAF8QUoA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA&tokens=false

Repro Code

function fn<Array extends readonly unknown[]>(array: Array) {
  return array;
};

ESLint Config

module.exports = {
  "rules": {
    "@typescript-eslint/array-type": "error"
  }
}

tsconfig

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

Expected Result

No errors.

Actual Result

Error on the generic type parameter.

Additional Info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginwontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions