# unbound-method

Rule `typescript/unbound-method`. Enforce unbound methods are called with their expected scope

- Source: typescript
- Technologies: TypeScript
- Kind: correctness
- Needs type information: yes
- Autofix: no
- Reach: 97M weekly downloads of presets that enable it
- Trend: +83.7% last quarter
- Rank: #193 by reach, #399 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `@typescript-eslint/unbound-method` | no | no | package `@typescript-eslint/eslint-plugin` | [docs](https://typescript-eslint.io/rules/unbound-method) |
| Oxlint | `typescript/unbound-method` | yes | no | plugin `typescript`, category correctness | [docs](https://oxc.rs/docs/guide/usage/linter/rules/typescript/unbound-method.html) |

## Code examples

### Incorrect: the rule reports this

```ts
class MyClass {
  public log(): void {
    console.log(this);
  }
}

const instance = new MyClass();

// This logs the global scope (`window`/`global`), not the class instance
const myLog = instance.log;
myLog();

// This log might later be called with an incorrect scope
const { log } = instance;

// arith.double may refer to `this` internally
const arith = {
  double(x: number): number {
    return x * 2;
  },
};
const { double } = arith;
```

### Correct: the rule accepts this

```ts
class MyClass {
  public logUnbound(): void {
    console.log(this);
  }

  public logBound = () => console.log(this);
}

const instance = new MyClass();

// logBound will always be bound with the correct scope
const { logBound } = instance;
logBound();

// .bind and lambdas will also add a correct scope
const dotBindLog = instance.logUnbound.bind(instance);
const innerLog = () => instance.logUnbound();

// arith.double explicitly declares that it does not refer to `this` internally
const arith = {
  double(this: void, x: number): number {
    return x * 2;
  },
};
const { double } = arith;
```

Examples from the ESLint documentation.

## Enable it

### ESLint: `eslint.config.js`

```js
import tseslint from "typescript-eslint";

export default [
  {
    plugins: { "@typescript-eslint": tseslint.plugin },
    rules: {
      "@typescript-eslint/unbound-method": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "rules": {
    "typescript/unbound-method": "error"
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Oxlint default](https://lintradar.dev/presets/oxlint-default.md) | Oxlint | `oxlint` | 111 | 50.8M | +183.6% |
| [typescript-eslint strict type-checked](https://lintradar.dev/presets/typescript-eslint-strict-type-checked.md) | ESLint | `@typescript-eslint/eslint-plugin` | 75 | 175.9M | +29.5% |
| [typescript-eslint recommended type-checked](https://lintradar.dev/presets/typescript-eslint-recommended-type-checked.md) | ESLint | `@typescript-eslint/eslint-plugin` | 47 | 175.9M | +29.5% |
| [Ultracite for Oxlint](https://lintradar.dev/presets/ultracite-oxlint.md) | Oxlint | `ultracite` | 475 | 2.1M | +151.7% |
| [eslint-config-love](https://lintradar.dev/presets/love.md) | ESLint | `eslint-config-love` | 258 | 171.7K | +39.3% |

## Related rules

- [jest/unbound-method](https://lintradar.dev/rules/jest/unbound-method.md): Enforce unbound methods are called with their expected scope
- [vitest/unbound-method](https://lintradar.dev/rules/vitest/unbound-method.md): Enforce unbound methods are called with their expected scope
- [typescript/no-useless-default-assignment](https://lintradar.dev/rules/typescript/no-useless-default-assignment.md): Disallow default values that will never be used
- [typescript/no-misused-spread](https://lintradar.dev/rules/typescript/no-misused-spread.md): Disallow using the spread operator when it might cause unexpected behavior
- [typescript/no-meaningless-void-operator](https://lintradar.dev/rules/typescript/no-meaningless-void-operator.md): Disallow the `void` operator except when used to discard a value
- [typescript/restrict-template-expressions](https://lintradar.dev/rules/typescript/restrict-template-expressions.md): Enforce template literal expressions to be of `string` type

---

Web page: https://lintradar.dev/rules/typescript/unbound-method. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
