---
# Don't modify this file manually. This file is auto generated from source, and you will lose your changes next time the website is built.
# Head to the `biomejs/biome` repository, and modify the source code in there.

title: noUselessTypeConstraint
description: Learn more about noUselessTypeConstraint
---
import { Tabs, TabItem } from '@astrojs/starlight/components';

<Tabs>
<TabItem label="TypeScript and TSX" icon="seti:typescript">
## Summary
- Rule available since: `v1.0.0`
- Diagnostic Category: [`lint/complexity/noUselessTypeConstraint`](/reference/diagnostics#diagnostic-category)
- This rule is **recommended**, meaning it is enabled by default.
- This rule has a [**safe**](/linter/#safe-fixes) fix.
- The default severity of this rule is [**information**](/reference/diagnostics#information).
- Sources: 
  - Same as [`@typescript-eslint/no-unnecessary-type-constraint`](https://typescript-eslint.io/rules/no-unnecessary-type-constraint)

## How to configure
```json title="biome.json"
{
	"linter": {
		"rules": {
			"complexity": {
				"noUselessTypeConstraint": "error"
			}
		}
	}
}

```
## Description
Disallow using `any` or `unknown` as type constraint.

Generic type parameters (`<T>`) in TypeScript may be **constrained** with [`extends`](https://www.typescriptlang.org/docs/handbook/generics.html#generic-constraints).
A supplied type must then be a subtype of the supplied constraint.
All types are subtypes of `any` and `unknown`.
It is thus useless to extend from `any` or `unknown`.

## Examples

### Invalid

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

<pre class="language-text"><code class="language-text">code-block.ts:1:20 <a href="https://biomejs.dev/linter/rules/no-useless-type-constraint">lint/complexity/noUselessTypeConstraint</a> <span style="color: #000; background-color: #ddd;"> FIXABLE </span> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━<br /><br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">Constraining a type parameter to </span><span style="color: lightgreen;"><strong>any</strong></span><span style="color: lightgreen;"> or </span><span style="color: lightgreen;"><strong>unknown</strong></span><span style="color: lightgreen;"> is useless.</span><br />  <br />  <strong><span style="color: Tomato;">&gt;</span></strong> <strong>1 │ </strong>interface FooAny&lt;T extends any&gt; &#123;&#125;<br />   <strong>   │ </strong>                   <strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><br />    <strong>2 │ </strong><br />  <br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">All types are subtypes of </span><span style="color: lightgreen;"><strong>any</strong></span><span style="color: lightgreen;"> and </span><span style="color: lightgreen;"><strong>unknown</strong></span><span style="color: lightgreen;">.</span><br />  <br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">Safe fix</span><span style="color: lightgreen;">: </span><span style="color: lightgreen;">Remove the constraint.</span><br />  <br />  <strong>  1 │ </strong>interface<span style="opacity: 0.8;">·</span>FooAny&lt;T<span style="opacity: 0.8;"><span style="color: Tomato;">·</span></span><span style="color: Tomato;">e</span><span style="color: Tomato;">x</span><span style="color: Tomato;">t</span><span style="color: Tomato;">e</span><span style="color: Tomato;">n</span><span style="color: Tomato;">d</span><span style="color: Tomato;">s</span><span style="opacity: 0.8;"><span style="color: Tomato;">·</span></span><span style="color: Tomato;">a</span><span style="color: Tomato;">n</span><span style="color: Tomato;">y</span>&gt;<span style="opacity: 0.8;">·</span>&#123;&#125;<br />  <strong>    │ </strong>                  <span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span>    <br /></code></pre>

```ts
type BarAny<T extends any> = {};
```

<pre class="language-text"><code class="language-text">code-block.ts:1:15 <a href="https://biomejs.dev/linter/rules/no-useless-type-constraint">lint/complexity/noUselessTypeConstraint</a> <span style="color: #000; background-color: #ddd;"> FIXABLE </span> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━<br /><br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">Constraining a type parameter to </span><span style="color: lightgreen;"><strong>any</strong></span><span style="color: lightgreen;"> or </span><span style="color: lightgreen;"><strong>unknown</strong></span><span style="color: lightgreen;"> is useless.</span><br />  <br />  <strong><span style="color: Tomato;">&gt;</span></strong> <strong>1 │ </strong>type BarAny&lt;T extends any&gt; = &#123;&#125;;<br />   <strong>   │ </strong>              <strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><br />    <strong>2 │ </strong><br />  <br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">All types are subtypes of </span><span style="color: lightgreen;"><strong>any</strong></span><span style="color: lightgreen;"> and </span><span style="color: lightgreen;"><strong>unknown</strong></span><span style="color: lightgreen;">.</span><br />  <br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">Safe fix</span><span style="color: lightgreen;">: </span><span style="color: lightgreen;">Remove the constraint.</span><br />  <br />  <strong>  1 │ </strong>type<span style="opacity: 0.8;">·</span>BarAny&lt;T<span style="opacity: 0.8;"><span style="color: Tomato;">·</span></span><span style="color: Tomato;">e</span><span style="color: Tomato;">x</span><span style="color: Tomato;">t</span><span style="color: Tomato;">e</span><span style="color: Tomato;">n</span><span style="color: Tomato;">d</span><span style="color: Tomato;">s</span><span style="opacity: 0.8;"><span style="color: Tomato;">·</span></span><span style="color: Tomato;">a</span><span style="color: Tomato;">n</span><span style="color: Tomato;">y</span>&gt;<span style="opacity: 0.8;">·</span>=<span style="opacity: 0.8;">·</span>&#123;&#125;;<br />  <strong>    │ </strong>             <span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span>       <br /></code></pre>

```ts
class BazAny<T extends any> {
}
```

<pre class="language-text"><code class="language-text">code-block.ts:1:16 <a href="https://biomejs.dev/linter/rules/no-useless-type-constraint">lint/complexity/noUselessTypeConstraint</a> <span style="color: #000; background-color: #ddd;"> FIXABLE </span> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━<br /><br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">Constraining a type parameter to </span><span style="color: lightgreen;"><strong>any</strong></span><span style="color: lightgreen;"> or </span><span style="color: lightgreen;"><strong>unknown</strong></span><span style="color: lightgreen;"> is useless.</span><br />  <br />  <strong><span style="color: Tomato;">&gt;</span></strong> <strong>1 │ </strong>class BazAny&lt;T extends any&gt; &#123;<br />   <strong>   │ </strong>               <strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><br />    <strong>2 │ </strong>&#125;<br />    <strong>3 │ </strong><br />  <br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">All types are subtypes of </span><span style="color: lightgreen;"><strong>any</strong></span><span style="color: lightgreen;"> and </span><span style="color: lightgreen;"><strong>unknown</strong></span><span style="color: lightgreen;">.</span><br />  <br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">Safe fix</span><span style="color: lightgreen;">: </span><span style="color: lightgreen;">Remove the constraint.</span><br />  <br />  <strong>  1 │ </strong>class<span style="opacity: 0.8;">·</span>BazAny&lt;T<span style="opacity: 0.8;"><span style="color: Tomato;">·</span></span><span style="color: Tomato;">e</span><span style="color: Tomato;">x</span><span style="color: Tomato;">t</span><span style="color: Tomato;">e</span><span style="color: Tomato;">n</span><span style="color: Tomato;">d</span><span style="color: Tomato;">s</span><span style="opacity: 0.8;"><span style="color: Tomato;">·</span></span><span style="color: Tomato;">a</span><span style="color: Tomato;">n</span><span style="color: Tomato;">y</span>&gt;<span style="opacity: 0.8;">·</span>&#123;<br />  <strong>    │ </strong>              <span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span>   <br /></code></pre>

```ts
class BazAny {
  quxAny<U extends any>() {}
}
```

<pre class="language-text"><code class="language-text">code-block.ts:2:12 <a href="https://biomejs.dev/linter/rules/no-useless-type-constraint">lint/complexity/noUselessTypeConstraint</a> <span style="color: #000; background-color: #ddd;"> FIXABLE </span> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━<br /><br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">Constraining a type parameter to </span><span style="color: lightgreen;"><strong>any</strong></span><span style="color: lightgreen;"> or </span><span style="color: lightgreen;"><strong>unknown</strong></span><span style="color: lightgreen;"> is useless.</span><br />  <br />    <strong>1 │ </strong>class BazAny &#123;<br />  <strong><span style="color: Tomato;">&gt;</span></strong> <strong>2 │ </strong>  quxAny&lt;U extends any&gt;() &#123;&#125;<br />   <strong>   │ </strong>           <strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><br />    <strong>3 │ </strong>&#125;<br />    <strong>4 │ </strong><br />  <br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">All types are subtypes of </span><span style="color: lightgreen;"><strong>any</strong></span><span style="color: lightgreen;"> and </span><span style="color: lightgreen;"><strong>unknown</strong></span><span style="color: lightgreen;">.</span><br />  <br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">Safe fix</span><span style="color: lightgreen;">: </span><span style="color: lightgreen;">Remove the constraint.</span><br />  <br />  <strong>  2 │ </strong><span style="opacity: 0.8;">·</span><span style="opacity: 0.8;">·</span>quxAny&lt;U<span style="opacity: 0.8;"><span style="color: Tomato;">·</span></span><span style="color: Tomato;">e</span><span style="color: Tomato;">x</span><span style="color: Tomato;">t</span><span style="color: Tomato;">e</span><span style="color: Tomato;">n</span><span style="color: Tomato;">d</span><span style="color: Tomato;">s</span><span style="opacity: 0.8;"><span style="color: Tomato;">·</span></span><span style="color: Tomato;">a</span><span style="color: Tomato;">n</span><span style="color: Tomato;">y</span>&gt;()<span style="opacity: 0.8;">·</span>&#123;&#125;<br />  <strong>    │ </strong>          <span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span>      <br /></code></pre>

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

<pre class="language-text"><code class="language-text">code-block.ts:1:20 <a href="https://biomejs.dev/linter/rules/no-useless-type-constraint">lint/complexity/noUselessTypeConstraint</a> <span style="color: #000; background-color: #ddd;"> FIXABLE </span> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━<br /><br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">Constraining a type parameter to </span><span style="color: lightgreen;"><strong>any</strong></span><span style="color: lightgreen;"> or </span><span style="color: lightgreen;"><strong>unknown</strong></span><span style="color: lightgreen;"> is useless.</span><br />  <br />  <strong><span style="color: Tomato;">&gt;</span></strong> <strong>1 │ </strong>const QuuxAny = &lt;T extends any&gt;() =&gt; &#123;&#125;;<br />   <strong>   │ </strong>                   <strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><br />    <strong>2 │ </strong><br />  <br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">All types are subtypes of </span><span style="color: lightgreen;"><strong>any</strong></span><span style="color: lightgreen;"> and </span><span style="color: lightgreen;"><strong>unknown</strong></span><span style="color: lightgreen;">.</span><br />  <br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">Safe fix</span><span style="color: lightgreen;">: </span><span style="color: lightgreen;">Remove the constraint.</span><br />  <br />  <strong>  1 │ </strong>const<span style="opacity: 0.8;">·</span>QuuxAny<span style="opacity: 0.8;">·</span>=<span style="opacity: 0.8;">·</span>&lt;T<span style="opacity: 0.8;"><span style="color: Tomato;">·</span></span><span style="color: Tomato;">e</span><span style="color: Tomato;">x</span><span style="color: Tomato;">t</span><span style="color: Tomato;">e</span><span style="color: Tomato;">n</span><span style="color: Tomato;">d</span><span style="color: Tomato;">s</span><span style="opacity: 0.8;"><span style="color: Tomato;">·</span></span><span style="color: Tomato;">a</span><span style="color: Tomato;">n</span><span style="color: Tomato;">y</span>&gt;()<span style="opacity: 0.8;">·</span>=&gt;<span style="opacity: 0.8;">·</span>&#123;&#125;;<br />  <strong>    │ </strong>                  <span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span>          <br /></code></pre>

```ts
function QuuzAny<T extends any>() {}
```

<pre class="language-text"><code class="language-text">code-block.ts:1:20 <a href="https://biomejs.dev/linter/rules/no-useless-type-constraint">lint/complexity/noUselessTypeConstraint</a> <span style="color: #000; background-color: #ddd;"> FIXABLE </span> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━<br /><br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">Constraining a type parameter to </span><span style="color: lightgreen;"><strong>any</strong></span><span style="color: lightgreen;"> or </span><span style="color: lightgreen;"><strong>unknown</strong></span><span style="color: lightgreen;"> is useless.</span><br />  <br />  <strong><span style="color: Tomato;">&gt;</span></strong> <strong>1 │ </strong>function QuuzAny&lt;T extends any&gt;() &#123;&#125;<br />   <strong>   │ </strong>                   <strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><br />    <strong>2 │ </strong><br />  <br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">All types are subtypes of </span><span style="color: lightgreen;"><strong>any</strong></span><span style="color: lightgreen;"> and </span><span style="color: lightgreen;"><strong>unknown</strong></span><span style="color: lightgreen;">.</span><br />  <br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">Safe fix</span><span style="color: lightgreen;">: </span><span style="color: lightgreen;">Remove the constraint.</span><br />  <br />  <strong>  1 │ </strong>function<span style="opacity: 0.8;">·</span>QuuzAny&lt;T<span style="opacity: 0.8;"><span style="color: Tomato;">·</span></span><span style="color: Tomato;">e</span><span style="color: Tomato;">x</span><span style="color: Tomato;">t</span><span style="color: Tomato;">e</span><span style="color: Tomato;">n</span><span style="color: Tomato;">d</span><span style="color: Tomato;">s</span><span style="opacity: 0.8;"><span style="color: Tomato;">·</span></span><span style="color: Tomato;">a</span><span style="color: Tomato;">n</span><span style="color: Tomato;">y</span>&gt;()<span style="opacity: 0.8;">·</span>&#123;&#125;<br />  <strong>    │ </strong>                  <span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span>      <br /></code></pre>

```ts
interface FooUnknown<T extends unknown> {}
```

<pre class="language-text"><code class="language-text">code-block.ts:1:24 <a href="https://biomejs.dev/linter/rules/no-useless-type-constraint">lint/complexity/noUselessTypeConstraint</a> <span style="color: #000; background-color: #ddd;"> FIXABLE </span> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━<br /><br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">Constraining a type parameter to </span><span style="color: lightgreen;"><strong>any</strong></span><span style="color: lightgreen;"> or </span><span style="color: lightgreen;"><strong>unknown</strong></span><span style="color: lightgreen;"> is useless.</span><br />  <br />  <strong><span style="color: Tomato;">&gt;</span></strong> <strong>1 │ </strong>interface FooUnknown&lt;T extends unknown&gt; &#123;&#125;<br />   <strong>   │ </strong>                       <strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><br />    <strong>2 │ </strong><br />  <br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">All types are subtypes of </span><span style="color: lightgreen;"><strong>any</strong></span><span style="color: lightgreen;"> and </span><span style="color: lightgreen;"><strong>unknown</strong></span><span style="color: lightgreen;">.</span><br />  <br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">Safe fix</span><span style="color: lightgreen;">: </span><span style="color: lightgreen;">Remove the constraint.</span><br />  <br />  <strong>  1 │ </strong>interface<span style="opacity: 0.8;">·</span>FooUnknown&lt;T<span style="opacity: 0.8;"><span style="color: Tomato;">·</span></span><span style="color: Tomato;">e</span><span style="color: Tomato;">x</span><span style="color: Tomato;">t</span><span style="color: Tomato;">e</span><span style="color: Tomato;">n</span><span style="color: Tomato;">d</span><span style="color: Tomato;">s</span><span style="opacity: 0.8;"><span style="color: Tomato;">·</span></span><span style="color: Tomato;">u</span><span style="color: Tomato;">n</span><span style="color: Tomato;">k</span><span style="color: Tomato;">n</span><span style="color: Tomato;">o</span><span style="color: Tomato;">w</span><span style="color: Tomato;">n</span>&gt;<span style="opacity: 0.8;">·</span>&#123;&#125;<br />  <strong>    │ </strong>                      <span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span>    <br /></code></pre>

```ts
type BarUnknown<T extends unknown> = {};
```

<pre class="language-text"><code class="language-text">code-block.ts:1:19 <a href="https://biomejs.dev/linter/rules/no-useless-type-constraint">lint/complexity/noUselessTypeConstraint</a> <span style="color: #000; background-color: #ddd;"> FIXABLE </span> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━<br /><br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">Constraining a type parameter to </span><span style="color: lightgreen;"><strong>any</strong></span><span style="color: lightgreen;"> or </span><span style="color: lightgreen;"><strong>unknown</strong></span><span style="color: lightgreen;"> is useless.</span><br />  <br />  <strong><span style="color: Tomato;">&gt;</span></strong> <strong>1 │ </strong>type BarUnknown&lt;T extends unknown&gt; = &#123;&#125;;<br />   <strong>   │ </strong>                  <strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><br />    <strong>2 │ </strong><br />  <br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">All types are subtypes of </span><span style="color: lightgreen;"><strong>any</strong></span><span style="color: lightgreen;"> and </span><span style="color: lightgreen;"><strong>unknown</strong></span><span style="color: lightgreen;">.</span><br />  <br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">Safe fix</span><span style="color: lightgreen;">: </span><span style="color: lightgreen;">Remove the constraint.</span><br />  <br />  <strong>  1 │ </strong>type<span style="opacity: 0.8;">·</span>BarUnknown&lt;T<span style="opacity: 0.8;"><span style="color: Tomato;">·</span></span><span style="color: Tomato;">e</span><span style="color: Tomato;">x</span><span style="color: Tomato;">t</span><span style="color: Tomato;">e</span><span style="color: Tomato;">n</span><span style="color: Tomato;">d</span><span style="color: Tomato;">s</span><span style="opacity: 0.8;"><span style="color: Tomato;">·</span></span><span style="color: Tomato;">u</span><span style="color: Tomato;">n</span><span style="color: Tomato;">k</span><span style="color: Tomato;">n</span><span style="color: Tomato;">o</span><span style="color: Tomato;">w</span><span style="color: Tomato;">n</span>&gt;<span style="opacity: 0.8;">·</span>=<span style="opacity: 0.8;">·</span>&#123;&#125;;<br />  <strong>    │ </strong>                 <span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span>       <br /></code></pre>

```ts
class BazUnknown<T extends unknown> {
}
```

<pre class="language-text"><code class="language-text">code-block.ts:1:20 <a href="https://biomejs.dev/linter/rules/no-useless-type-constraint">lint/complexity/noUselessTypeConstraint</a> <span style="color: #000; background-color: #ddd;"> FIXABLE </span> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━<br /><br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">Constraining a type parameter to </span><span style="color: lightgreen;"><strong>any</strong></span><span style="color: lightgreen;"> or </span><span style="color: lightgreen;"><strong>unknown</strong></span><span style="color: lightgreen;"> is useless.</span><br />  <br />  <strong><span style="color: Tomato;">&gt;</span></strong> <strong>1 │ </strong>class BazUnknown&lt;T extends unknown&gt; &#123;<br />   <strong>   │ </strong>                   <strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><br />    <strong>2 │ </strong>&#125;<br />    <strong>3 │ </strong><br />  <br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">All types are subtypes of </span><span style="color: lightgreen;"><strong>any</strong></span><span style="color: lightgreen;"> and </span><span style="color: lightgreen;"><strong>unknown</strong></span><span style="color: lightgreen;">.</span><br />  <br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">Safe fix</span><span style="color: lightgreen;">: </span><span style="color: lightgreen;">Remove the constraint.</span><br />  <br />  <strong>  1 │ </strong>class<span style="opacity: 0.8;">·</span>BazUnknown&lt;T<span style="opacity: 0.8;"><span style="color: Tomato;">·</span></span><span style="color: Tomato;">e</span><span style="color: Tomato;">x</span><span style="color: Tomato;">t</span><span style="color: Tomato;">e</span><span style="color: Tomato;">n</span><span style="color: Tomato;">d</span><span style="color: Tomato;">s</span><span style="opacity: 0.8;"><span style="color: Tomato;">·</span></span><span style="color: Tomato;">u</span><span style="color: Tomato;">n</span><span style="color: Tomato;">k</span><span style="color: Tomato;">n</span><span style="color: Tomato;">o</span><span style="color: Tomato;">w</span><span style="color: Tomato;">n</span>&gt;<span style="opacity: 0.8;">·</span>&#123;<br />  <strong>    │ </strong>                  <span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span>   <br /></code></pre>

```ts
class BazUnknown {
  quxUnknown<U extends unknown>() {}
}
```

<pre class="language-text"><code class="language-text">code-block.ts:2:16 <a href="https://biomejs.dev/linter/rules/no-useless-type-constraint">lint/complexity/noUselessTypeConstraint</a> <span style="color: #000; background-color: #ddd;"> FIXABLE </span> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━<br /><br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">Constraining a type parameter to </span><span style="color: lightgreen;"><strong>any</strong></span><span style="color: lightgreen;"> or </span><span style="color: lightgreen;"><strong>unknown</strong></span><span style="color: lightgreen;"> is useless.</span><br />  <br />    <strong>1 │ </strong>class BazUnknown &#123;<br />  <strong><span style="color: Tomato;">&gt;</span></strong> <strong>2 │ </strong>  quxUnknown&lt;U extends unknown&gt;() &#123;&#125;<br />   <strong>   │ </strong>               <strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><br />    <strong>3 │ </strong>&#125;<br />    <strong>4 │ </strong><br />  <br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">All types are subtypes of </span><span style="color: lightgreen;"><strong>any</strong></span><span style="color: lightgreen;"> and </span><span style="color: lightgreen;"><strong>unknown</strong></span><span style="color: lightgreen;">.</span><br />  <br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">Safe fix</span><span style="color: lightgreen;">: </span><span style="color: lightgreen;">Remove the constraint.</span><br />  <br />  <strong>  2 │ </strong><span style="opacity: 0.8;">·</span><span style="opacity: 0.8;">·</span>quxUnknown&lt;U<span style="opacity: 0.8;"><span style="color: Tomato;">·</span></span><span style="color: Tomato;">e</span><span style="color: Tomato;">x</span><span style="color: Tomato;">t</span><span style="color: Tomato;">e</span><span style="color: Tomato;">n</span><span style="color: Tomato;">d</span><span style="color: Tomato;">s</span><span style="opacity: 0.8;"><span style="color: Tomato;">·</span></span><span style="color: Tomato;">u</span><span style="color: Tomato;">n</span><span style="color: Tomato;">k</span><span style="color: Tomato;">n</span><span style="color: Tomato;">o</span><span style="color: Tomato;">w</span><span style="color: Tomato;">n</span>&gt;()<span style="opacity: 0.8;">·</span>&#123;&#125;<br />  <strong>    │ </strong>              <span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span>      <br /></code></pre>

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

<pre class="language-text"><code class="language-text">code-block.ts:1:24 <a href="https://biomejs.dev/linter/rules/no-useless-type-constraint">lint/complexity/noUselessTypeConstraint</a> <span style="color: #000; background-color: #ddd;"> FIXABLE </span> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━<br /><br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">Constraining a type parameter to </span><span style="color: lightgreen;"><strong>any</strong></span><span style="color: lightgreen;"> or </span><span style="color: lightgreen;"><strong>unknown</strong></span><span style="color: lightgreen;"> is useless.</span><br />  <br />  <strong><span style="color: Tomato;">&gt;</span></strong> <strong>1 │ </strong>const QuuxUnknown = &lt;T extends unknown&gt;() =&gt; &#123;&#125;;<br />   <strong>   │ </strong>                       <strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><br />    <strong>2 │ </strong><br />  <br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">All types are subtypes of </span><span style="color: lightgreen;"><strong>any</strong></span><span style="color: lightgreen;"> and </span><span style="color: lightgreen;"><strong>unknown</strong></span><span style="color: lightgreen;">.</span><br />  <br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">Safe fix</span><span style="color: lightgreen;">: </span><span style="color: lightgreen;">Remove the constraint.</span><br />  <br />  <strong>  1 │ </strong>const<span style="opacity: 0.8;">·</span>QuuxUnknown<span style="opacity: 0.8;">·</span>=<span style="opacity: 0.8;">·</span>&lt;T<span style="opacity: 0.8;"><span style="color: Tomato;">·</span></span><span style="color: Tomato;">e</span><span style="color: Tomato;">x</span><span style="color: Tomato;">t</span><span style="color: Tomato;">e</span><span style="color: Tomato;">n</span><span style="color: Tomato;">d</span><span style="color: Tomato;">s</span><span style="opacity: 0.8;"><span style="color: Tomato;">·</span></span><span style="color: Tomato;">u</span><span style="color: Tomato;">n</span><span style="color: Tomato;">k</span><span style="color: Tomato;">n</span><span style="color: Tomato;">o</span><span style="color: Tomato;">w</span><span style="color: Tomato;">n</span>&gt;()<span style="opacity: 0.8;">·</span>=&gt;<span style="opacity: 0.8;">·</span>&#123;&#125;;<br />  <strong>    │ </strong>                      <span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span>          <br /></code></pre>

```ts
function QuuzUnknown<T extends unknown>() {}
```

<pre class="language-text"><code class="language-text">code-block.ts:1:24 <a href="https://biomejs.dev/linter/rules/no-useless-type-constraint">lint/complexity/noUselessTypeConstraint</a> <span style="color: #000; background-color: #ddd;"> FIXABLE </span> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━<br /><br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">Constraining a type parameter to </span><span style="color: lightgreen;"><strong>any</strong></span><span style="color: lightgreen;"> or </span><span style="color: lightgreen;"><strong>unknown</strong></span><span style="color: lightgreen;"> is useless.</span><br />  <br />  <strong><span style="color: Tomato;">&gt;</span></strong> <strong>1 │ </strong>function QuuzUnknown&lt;T extends unknown&gt;() &#123;&#125;<br />   <strong>   │ </strong>                       <strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><br />    <strong>2 │ </strong><br />  <br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">All types are subtypes of </span><span style="color: lightgreen;"><strong>any</strong></span><span style="color: lightgreen;"> and </span><span style="color: lightgreen;"><strong>unknown</strong></span><span style="color: lightgreen;">.</span><br />  <br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">Safe fix</span><span style="color: lightgreen;">: </span><span style="color: lightgreen;">Remove the constraint.</span><br />  <br />  <strong>  1 │ </strong>function<span style="opacity: 0.8;">·</span>QuuzUnknown&lt;T<span style="opacity: 0.8;"><span style="color: Tomato;">·</span></span><span style="color: Tomato;">e</span><span style="color: Tomato;">x</span><span style="color: Tomato;">t</span><span style="color: Tomato;">e</span><span style="color: Tomato;">n</span><span style="color: Tomato;">d</span><span style="color: Tomato;">s</span><span style="opacity: 0.8;"><span style="color: Tomato;">·</span></span><span style="color: Tomato;">u</span><span style="color: Tomato;">n</span><span style="color: Tomato;">k</span><span style="color: Tomato;">n</span><span style="color: Tomato;">o</span><span style="color: Tomato;">w</span><span style="color: Tomato;">n</span>&gt;()<span style="opacity: 0.8;">·</span>&#123;&#125;<br />  <strong>    │ </strong>                      <span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span><span style="color: Tomato;">-</span>      <br /></code></pre>

### Valid

```ts
interface Foo<T> {}

type Bar<T> = {};
```

## Related links

- [Disable a rule](/linter/#disable-a-rule)
- [Configure the code fix](/linter#configure-the-code-fix)
- [Rule options](/linter/#rule-options)
- [Source Code](https://github.com/biomejs/biome/blob/main/crates/biome_js_analyze/src/lint/complexity/no_useless_type_constraint.rs)
- [Test Cases](https://github.com/biomejs/biome/blob/main/crates/biome_js_analyze/tests/specs/complexity/noUselessTypeConstraint)

</TabItem>
</Tabs>