# @typescript-eslint/no-unsafe-call

> Disallow calling a value of type `any`

The compiler lets you call an `any` with any arguments. It doesn't check that the value is a function, and the result is `any` again. If the value isn't a function, you find out from a `TypeError` when the code runs.

The rule reports calls, `new`, and tagged templates. It also reports a value of type `Function`, which says you can call something but not which arguments it takes. A type that can't be resolved, for example from a missing import, counts as `any`.

`bun lint --type-aware` turns this rule on in TypeScript files.

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

## Configure

Off by default. This rule needs types, so turning it on makes `bun lint` type check your code first.

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

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

## Examples

Reported:

{/* bad {"count": 4} */}
```ts
function run(plugin: any, handler: Function) {
  plugin();
  plugin.setup();
  new plugin.Worker();
  handler();
}
```

Not reported:

{/* good */}
```ts
interface Plugin {
  setup(): void;
  Worker: new () => object;
}

function run(plugin: Plugin, handler: () => void) {
  plugin.setup();
  new plugin.Worker();
  handler();
}
```

For a value you know nothing about, use `unknown` and check it before the call:

{/* good */}
```ts
function stop(controller: unknown) {
  if (controller instanceof AbortController) {
    controller.abort();
  }
}
```

## When not to use it

In a codebase that's still moving from JavaScript to TypeScript, `any` is everywhere and the reports drown out everything else. Turn the rule on once most values have real types.
