> For AI agents: the complete documentation index is available at https://rslint.rs/llms.txt, the full documentation bundle is available at https://rslint.rs/llms-full.txt.

# no-unnecessary-type-constraint

[Added in v0.5.0](https://github.com/web-infra-dev/rslint/releases/tag/v0.5.0)
## Configuration

| Preset                              | Configured Value |
| ----------------------------------- | ---------------- |
| ✅ ts.configs.recommended            | `"error"`        |
| ✅ ts.configs.recommendedTypeChecked | `"error"`        |
| ✅ ts.configs.strict                 | `"error"`        |
| ✅ ts.configs.strictTypeChecked      | `"error"`        |


```ts title=rslint.config.ts
import { defineConfig, ts } from '@rslint/core';

export default defineConfig([
  ts.configs.recommended,
  {
    rules: {
      '@typescript-eslint/no-unnecessary-type-constraint': 'error',
    },
  },
]);
```

## Rule Details

This rule disallows unnecessary constraints on generic types. Type parameters (`<T>`) default to `unknown`, so constraining a generic type parameter to `any` or `unknown` has no effect.

Examples of **incorrect** code for this rule:

```typescript
interface FooAny<T extends any> {}

class BarAny<T extends any> {}

function BazAny<T extends any>() {}

const QuuxAny = <T extends any>() => {};

interface FooUnknown<T extends unknown> {}

class BarUnknown<T extends unknown> {}

function BazUnknown<T extends unknown>() {}

const QuuxUnknown = <T extends unknown>() => {};
```

Examples of **correct** code for this rule:

```typescript
interface Foo<T> {}

class Bar<T> {}

function Baz<T>() {}

const Quux = <T>() => {};
```

## Original Documentation

- [typescript-eslint: no-unnecessary-type-constraint](https://typescript-eslint.io/rules/no-unnecessary-type-constraint)
- [Source code](https://github.com/typescript-eslint/typescript-eslint/blob/v8.67.0/packages/eslint-plugin/src/rules/no-unnecessary-type-constraint.ts)
