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

Skip to content

[prefer-function-type] false positive on global augmentation #454

@mysticatea

Description

@mysticatea

Repro

{
  "rules": {
    "@typescript-eslint/prefer-function-type": "error"
  }
}
export {}
declare global {
    interface Function {
        (...args: any[]): any
    }
}

Expected Result

No errors because the type alias with a function type causes a syntax error (Duplicate identifier 'Function').

Actual Result

  5:9  error  Interface has only a call signature - use 'type Function = (...args: any[]) => any' instead  @typescript-eslint/prefer-function-type

Additional Info

Versions

package version
@typescript-eslint/eslint-plugin 1.7.0
@typescript-eslint/parser 1.7.0
TypeScript 3.4.3
ESLint 5.16.0
node 10.15.3
npm 6.9.0

Metadata

Metadata

Labels

accepting prsGo ahead, send a pull request that resolves this issuebreaking changeThis change will require a new major version to be releasedbugSomething isn't workingpackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions