# @typescript-eslint/method-signature-style

> Enforce one way to write a method in an interface or type literal

An interface can declare a function member in two ways: as a method, `save(user: User): void`, or as a property with a function type, `save: (user: User) => void`. They look the same to a caller, but TypeScript checks them differently. With `strictFunctionTypes`, TypeScript checks a property's parameters strictly. It doesn't do that for a method's parameters, so you can assign a function that only accepts a narrower type, and it fails when it's called with the wider one.

By default the rule asks for the property form.

`--fix` rewrites the signature. Overloads of one method become an intersection of function types. These are reported but not fixed:

- a method that returns `this`
- a method inside a `namespace` or `declare module` block
- with `"method"`, a `readonly` property, because a method can't be `readonly`. The report offers the change as a suggestion.

{/* Generated by src/codegen/lint-rule-docs.ts. Do not edit this section. */}

## Configure

Off by default. To turn it on:

```toml bunfig.toml
[lint.rules]
"@typescript-eslint/method-signature-style" = "error" # or "warn"
```

Every option, set to its default:

```toml bunfig.toml
[lint.rules]
# "property" or "method"
"@typescript-eslint/method-signature-style" = ["error", "property"]
```

{/* End of the generated section. */}

## Examples

Reported:

{/* bad */}
```ts
interface Store {
  save(user: string): void;
}
```

Not reported:

{/* good */}
```ts
interface Store {
  save: (user: string) => void;
  get size(): number;
}
```

## Options

```toml bunfig.toml
[lint.rules]
"@typescript-eslint/method-signature-style" = ["error", "method"]
```

| Option | What it does |
| --- | --- |
| `"property"` (default) | Report `save(user: string): void`. |
| `"method"` | Report `save: (user: string) => void`. |

{/* bad {"options": ["method"]} */}
```ts
type Store = {
  save: (user: string) => void;
};
```

{/* good {"options": ["method"]} */}
```ts
type Store = {
  save(user: string): void;
};
```

## When not to use it

Without `strictFunctionTypes`, which is part of `strict`, TypeScript checks both forms the same way and the rule is only about style.
