8000 Bug: [unified-signatures] Crash in rule implementation · Issue #6882 · typescript-eslint/typescript-eslint · GitHub
[go: up one dir, main page]

Skip to content
Bug: [unified-signatures] Crash in rule implementation #6882
Closed
@danielrentz

Description

@danielr
7FA1
entz

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=4.9.3&sourceType=module&showAST=es&code=KYDwDg9gTgLgBAQwEYGcZQQY3pgNglFOAFWDTgG8BYAKDkVXS3gFtgYALCAEwAoAzfAHMAXHHQBXYAEoxAOwkskwKAG5a9ZGgzY4bTj16y42gJZyh6mgF9aQA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6WJygM0sQBNaySgHMmAQ3yxoKdGADakRNGgB7aJAA0mKCKZrEAEW5cliFvEIA5MQFt+ABTHRbifEtQZ8cRGAC+AXXA-EF8gA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA

Repro Code

export abstract class Test {
    abstract method(flag: true): number;
    abstract method(): string;
}

ESLint Config

module.exports = {
  parser: "@typescript-eslint/parser",
  rules: {
    "@typescript-eslint/unified-signatures": ["error", { ignoreDifferentlyNamedParameters: true }],
  },
};

tsconfig

{
  "compilerOptions": {
    "strict": true
  }
}

Expected Result

Linter should pass.

Actual Result

Oops! Something went wrong! :(

ESLint: 8.38.0

TypeError: Cannot read properties of undefined (reading 'type')
Occurred while linting test.ts:13
Rule: "@typescript-eslint/unified-signatures"
    at signaturesCanBeUnified (./node_modules/@typescript-eslint/eslint-plugin/dist/rules/unified-signatures.js:146:58)
    at compareSignatures (./node_modules/@typescript-eslint/eslint-plugin/dist/rules/unified-signatures.js:133:18)
    at ./node_modules/@typescript-eslint/eslint-plugin/dist/rules/unified-signatures.js:124:35
    at forEachPair (./node_modules/@typescript-eslint/eslint-plugin/dist/rules/unified-signatures.js:311:21)
    at checkOverloads (./node_modules/@typescript-eslint/eslint-plugin/dist/rules/unified-signatures.js:120:17)
    at checkScope (./node_modules/@typescript-eslint/eslint-plugin/dist/rules/unified-signatures.js:328:30)
    at ruleErrorHandler (./node_modules/eslint/lib/linter/linter.js:1077:28)
    at ./node_modules/eslint/lib/linter/safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (./node_modules/eslint/lib/linter/safe-emitter.js:45:38)

Additional Info

Happens only with option "ignoreDifferentlyNamedParameters".

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issuebugSomething isn't workinggood first issueGood for newcomerspackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0