---
title: "@typescript-eslint/prefer-function-type"
description: "Require a function type instead of an interface or object type with only a call signature"
# Generated by src/codegen/lint-rule-docs.ts. Do not edit below this line.
plugin: "typescript"
aliases: ["typescript-eslint/prefer-function-type","typescript/prefer-function-type"]
kind: "suggestion"
category: "style"
default: "off"
fixable: "yes"
typeAware: false
deprecated: false
---

An interface with a call signature and nothing else describes a function. `type Handler = (event: Event) => void` says the same thing in one line.

Inline object types and `new (...)` signatures are checked too. An interface that extends another interface is left alone.

`--fix` rewrites the interface to a type alias, and the object type to a function type.

{/* 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/prefer-function-type" = "error" # or "warn"
```

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

## Examples

Reported:

{/* bad {"count": 2} */}
```ts
interface Handler {
  (event: Event): void;
}

function listen(callback: { (event: Event): void }) {}
```

Not reported:

{/* good */}
```ts
type Handler = (event: Event) => void;

function listen(callback: (event: Event) => void) {}
```

A type with another member, or with more than one call signature, can't be written as a function type:

{/* good */}
```ts
interface Logger {
  (message: string): void;
  level: number;
}

interface Parse {
  (text: string): object;
  (text: string, strict: boolean): object;
}

interface Timed extends Logger {
  (message: string): void;
}
```

In an interface, `this` as a type means the interface itself. A function type has no such `this`, so the rule points at it and doesn't offer a fix:

{/* bad */}
```ts
interface Chain {
  (step: string): this;
}
```
