# related-getter-setter-pairs

Rule `typescript/related-getter-setter-pairs`. Enforce that `get()` types should be assignable to their equivalent `set()` type

- Source: typescript
- Technologies: TypeScript
- Kind: suspicious
- Needs type information: yes
- Autofix: no
- Reach: 46.6M weekly downloads of presets that enable it
- Trend: +31.9% last quarter
- Rank: #286 by reach, #1112 by growth

## Linters

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

## Code examples

### Incorrect: the rule reports this

```ts
interface Box {
  get value(): string;
  set value(newValue: number);
}
```

### Correct: the rule accepts this

```ts
interface Box {
  get value(): string;
  set value(newValue: string);
}
```

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/related-getter-setter-pairs": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "rules": {
    "typescript/related-getter-setter-pairs": "error"
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [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% |
| [Ultracite for Oxlint](https://lintradar.dev/presets/ultracite-oxlint.md) | Oxlint | `ultracite` | 475 | 2.1M | +151.7% |
| [XO](https://lintradar.dev/presets/xo.md) | ESLint | `eslint-config-xo` | 618 | 413K | −5.0% |
| [eslint-config-love](https://lintradar.dev/presets/love.md) | ESLint | `eslint-config-love` | 258 | 171.7K | +39.3% |

## Related rules

- [typescript/prefer-return-this-type](https://lintradar.dev/rules/typescript/prefer-return-this-type.md): Enforce that `this` is used when only `this` type is returned
- [typescript/use-unknown-in-catch-callback-variable](https://lintradar.dev/rules/typescript/use-unknown-in-catch-callback-variable.md): Enforce typing arguments in Promise rejection callbacks as `unknown`
- [typescript/no-unsafe-enum-assignment](https://lintradar.dev/rules/typescript/no-unsafe-enum-assignment.md): Disallow assigning non-enum values to enum typed locations
- [typescript/no-confusing-non-null-assertion](https://lintradar.dev/rules/typescript/no-confusing-non-null-assertion.md): Disallow non-null assertion in locations that may be confusing
- [typescript/no-empty-function](https://lintradar.dev/rules/typescript/no-empty-function.md): Disallow empty functions
- [typescript/consistent-generic-constructors](https://lintradar.dev/rules/typescript/consistent-generic-constructors.md): Enforce specifying generic type arguments on type annotation or constructor name of a constructor call

---

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