10BC0 Bug: [no-extra-parens] False positive when calling generic function with type tuple parameter containing parenthesis · Issue #7030 · typescript-eslint/typescript-eslint · GitHub
[go: up one dir, main page]

Skip to content
Bug: [no-extra-parens] False positive when calling generic function with type tuple parameter containing parenthesis #7030
@burtek

Description

@burtek

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.0.4&sourceType=module&code=CYUwxgNghgTiAEYD2A7AzgF3hkmBc8A3gFDzwhRgAWBJZZAPAIIwDma5AHjisBwK4oA1iiQB3FAG0AugD4AFLBgEW7GQEoC8jAEsMEEAUwwdKVgBp4AMxRaAdA9jsVbNOvgBeWfABuSHcDuXr7+wKTwAL7EUcQ4mHYU1AySTgCMWij8ALYARiAw8AA+8MamrOoylk4ATASZufly8pLhkpKp0pbVna2SAOTVfZ3wAMzSxNLq8n26+iB9lopsqVVs1UHedPDR6sRAA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6Jge3oA99oBDWsX7RETVBkiJo0DtEjgwAXxBKgA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA

Repro Code

declare const test: {
  each: {
    <Args extends unknown[]>(arr: Args[]): (title: string, fn: (...args: Args) => void) => void
  }
}

test.each<[arg1: (number | string)[], arg2: number]>([
  [[1], 2],
  [['2'], 3]
])('title', (arg1, arg2) => {
  
})

ESLint Config

module.exports = {
  parser: "@typescript-eslint/parser",
  rules: {
    "@typescript-eslint/no-extra-parens": "error"
  }
};

tsconfig

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

Expected Result

No error

Actual Result

Unnecessary parentheses around expression. 7:53 - 7:54

Additional Info

Similar to #5488, but more sophisticated issue found while writing tests with jest.

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issuebugSomething isn't workingformattingRelated to whitespace/bracket formatting. We strongly recommend you use a formatter instead.package: 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