Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[prefer-function-type] fix generates invalid code in union or intersection typesΒ #3000

@tao-cumplido

Description

@tao-cumplido
  • 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/prefer-function-type": ["error"]
  }
}
type X = {} | {
  (): void;
}

Expected Result

type X = {} | (() => void)

Actual Result

type X = {} | (() => void;) // ')' expected. ts(1005)

Additional Info

Versions

package version
@typescript-eslint/eslint-plugin 4.14.2
@typescript-eslint/parser 4.14.2
TypeScript 4.1.3
ESLint 7.19.0
node 14.15.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    has 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