# @typescript-eslint/no-unsafe-function-type

> Disallow the built-in `Function` type

You can call a value of type `Function` with any arguments, and the result is `any`, so TypeScript checks nothing about the call. `Function` also accepts classes, which throw when you call them without `new`.

Write the parameters and the return type instead.

This rule is on by default in TypeScript files.

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

## Configure

On by default as a warning. To turn it off:

```toml bunfig.toml
[lint.rules]
"@typescript-eslint/no-unsafe-function-type" = "off" # or "error"
```

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

## Examples

Reported:

{/* bad */}
```ts
function onChange(listener: Function) {
  listener("name", 1, 2, 3);
}
```

Not reported:

{/* good */}
```ts
function onChange(listener: (field: string) => void) {
  listener("name");
}
```

An interface that extends `Function` is reported too:

{/* bad */}
```ts
interface Handler extends Function {
  priority: number;
}
```

To accept any function at all, use a signature that every function matches:

{/* good */}
```ts
function nameOf(task: (...args: never[]) => unknown) {
  return task.name;
}
```

Your own type named `Function` isn't reported:

{/* good */}
```ts
import type { Function } from "./ast";

export function visit(node: Function) {}
```
