Skip to content

[array-type] Incorrect fix when using an Array of arrow functions with rest parameters #4756

Closed
@cheit-epic

Description

@cheit-epic
  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have read the FAQ and my problem is not listed.

Repro

{
  "rules": {
    "@typescript-eslint/array-type": "error"
  }
}
const foo: Array<new (...args: any[]) => void> = [];

Expected Result

const foo: (new (...args: any[]) => void)[] = [];

Actual Result

const foo: new (...args: any[]) => void[] = [];

The lack of parentheses changes the type to be "a function that returns void[]" rather than "an array of functions that return void"

Versions

package version
@typescript-eslint/eslint-plugin 5.17.0
@typescript-eslint/parser 5.17.0
TypeScript 4.4.4
ESLint 8.8.0
node 8.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghas prthere is a PR raised to close thispackage: 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