Skip to content

Docs: [unified-signatures] remove invalid examples from docs #6284

Closed
@SuperSodaSea

Description

@SuperSodaSea

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.4&sourceType=module&code=CYUwxgNghgTiAEAzArgOzAFwJYHtVIAoA6EqALnlWQFsAjEGAbQF0BKCgNxy2AG4BYAFChIsBCnTY8hEkXLwAzhhhZUAcxbt4XHgMFCR0OEjSZc+NcVIUqdBps7c+B8EfGmpFq0VoUlK9QdtJz0gA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6WJygM0sQBNaySgHMmAQ3yxoKdGADakRNGgB7aJAA0mKCKZrEAEW5cliFvEIA5MQFt+ABTHRbifEtQZ8cRGAC+AXXA-EF8gA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA

Repro Code

declare function f(...a: number[]): void;
declare function f(...a: string[]): void;

declare function g(...a: number[]): void;
declare function g(...b: string[]): void;

ESLint Config

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

tsconfig

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

Expected Result

In unified-signatures' document:

// "@typescript-eslint/unified-signatures": ["error", { "ignoreDifferentlyNamedParameters": true }]

// Incorrect
function f(...a: number[]): void;
function f(...b: string[]): void;

// Correct
function f(...a: number[]): void;
function f(...a: string[]): void;

In my opinion the document is also wrong. The first one with different name should be correct, and the second one with the same name should be incorrect.

Actual Result

No error is given, no matter ignoreDifferentlyNamedParameters is true or false.

Additional Info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issuedocumentationDocumentation ("docs") that needs adding/updatingpackage: 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