目录

@typescript-eslint/method-signature-style

Enforce using a particular method signature syntax.

There are two ways to define an object/interface function property: property, using property signature for functions; method, using method signature for functions.

This rule applies only to .js and .ts files.

Rule Configuration

// code-linter.json5
{
  "rules": {
    "@typescript-eslint/method-signature-style": "error"
  }
}

Options

For details, see @typescript-eslint/method-signature-style.

Example of Correct Code

// By default, the property syntax is used.
export interface T1 {
  func: (arg: string) => number;
}

Example of Incorrect Code

// By default, the property syntax is used.
export interface T1 {
  func(arg: string): number;
}

Rule Set

plugin:@typescript-eslint/all

For details about how to configure Code Linter check rules, see Code Linter.