8000 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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
4 tasks done
burtek opened this issue May 15, 2023 · 3 comments · Fixed by #7375
Labels
accepting prs Go ahead, send a pull request that resolves this issue bug Something isn't working formatting Related to whitespace/bracket formatting. We strongly recommend you use a formatter instead. package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@burtek
Copy link
Contributor
burtek commented May 15, 2023

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.

@burtek burtek added bug Something isn't working package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for team members to take a look labels May 15, 2023
@burtek burtek changed the title Bug: [no-extra-parens] False positive when calling generic function with type parameter with parentheses Bug: [no-extra-parens] False positive when calling generic function with type tuple parameter containing parenthesis May 15, 2023
@bradzacher bradzacher added accepting prs Go ahead, send a pull request that resolves this issue formatting Related to whitespace/bracket formatting. We strongly recommend you use a formatter instead. and removed triage Waiting for team members to take a look labels May 15, 2023
@xsjcTony
Copy link

Isn't this the same issue? #5488

@burtek
Copy link
Contributor Author
burtek commented May 16, 2023

@xsjcTony The example from #5488 works correctly with listed versions, but mine does not. Might be the same issue but that would imply #5488 wasn't fixed correctly. Anyway, #5488 was marked as fixed ages ago and the issue is still present, hence new ticket.

@u-abyss
Copy link
Contributor
u-abyss commented May 23, 2023

I'll do this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepting prs Go ahead, send a pull request that resolves this issue bug Something isn't working formatting Related to whitespace/bracket formatting. We strongly recommend you use a formatter instead. package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
4 participants
0