---
# 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: noExplicitAny
description: Learn more about noExplicitAny
---
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/suspicious/noExplicitAny`](/reference/diagnostics#diagnostic-category)
- This rule is **recommended**, meaning it is enabled by default.
- This rule doesn't have a fix.
- The default severity of this rule is [**warning**](/reference/diagnostics#warning).
- Sources: 
  - Same as [`@typescript-eslint/no-explicit-any`](https://typescript-eslint.io/rules/no-explicit-any)

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

```
## Description
Disallow the `any` type usage.

The `any` type in TypeScript is a dangerous "escape hatch" from the type system.
Using `any` disables many type checking rules and is generally best used only as a last resort or when prototyping code.

TypeScript's `--noImplicitAny` compiler option prevents an implied `any`,
but doesn't prevent `any` from being explicitly used the way this rule does.

Sometimes you can use the type `unknown` instead of the type `any`.
It also accepts any value, however it requires to check that a property exists before calling it.

## Examples

### Invalid

```ts
let variable: any = 1;
```

<pre class="language-text"><code class="language-text">code-block.ts:1:15 <a href="https://biomejs.dev/linter/rules/no-explicit-any">lint/suspicious/noExplicitAny</a> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━<br /><br />  <strong><span style="color: Orange;">⚠</span></strong> <span style="color: Orange;">Unexpected </span><span style="color: Orange;"><strong>any</strong></span><span style="color: Orange;">. Specify a different type.</span><br />  <br />  <strong><span style="color: Tomato;">&gt;</span></strong> <strong>1 │ </strong>let variable: any = 1;<br />   <strong>   │ </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;"><strong>any</strong></span><span style="color: lightgreen;"> disables many type checking rules. Its use should be avoided.</span><br />  <br /></code></pre>

```ts
class SomeClass {
   message: Array<Array<any>>;
}
```

<pre class="language-text"><code class="language-text">code-block.ts:2:25 <a href="https://biomejs.dev/linter/rules/no-explicit-any">lint/suspicious/noExplicitAny</a> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━<br /><br />  <strong><span style="color: Orange;">⚠</span></strong> <span style="color: Orange;">Unexpected </span><span style="color: Orange;"><strong>any</strong></span><span style="color: Orange;">. Specify a different type.</span><br />  <br />    <strong>1 │ </strong>class SomeClass &#123;<br />  <strong><span style="color: Tomato;">&gt;</span></strong> <strong>2 │ </strong>   message: Array&lt;Array&lt;any&gt;&gt;;<br />   <strong>   │ </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;"><strong>any</strong></span><span style="color: lightgreen;"> disables many type checking rules. Its use should be avoided.</span><br />  <br /></code></pre>

```ts
function fn(param: Array<any>): void {}
```

<pre class="language-text"><code class="language-text">code-block.ts:1:26 <a href="https://biomejs.dev/linter/rules/no-explicit-any">lint/suspicious/noExplicitAny</a> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━<br /><br />  <strong><span style="color: Orange;">⚠</span></strong> <span style="color: Orange;">Unexpected </span><span style="color: Orange;"><strong>any</strong></span><span style="color: Orange;">. Specify a different type.</span><br />  <br />  <strong><span style="color: Tomato;">&gt;</span></strong> <strong>1 │ </strong>function fn(param: Array&lt;any&gt;): void &#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><br />    <strong>2 │ </strong><br />  <br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;"><strong>any</strong></span><span style="color: lightgreen;"> disables many type checking rules. Its use should be avoided.</span><br />  <br /></code></pre>

### Valid

```ts
let variable: number = 1;
let variable2 = 1;
```

```ts
class SomeClass<T extends any> {
   message: Array<Array<unknown>>;
}
```

```ts
function fn(param: Array<Array<unknown>>): Array<unknown> {}
```

## 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/suspicious/no_explicit_any.rs)
- [Test Cases](https://github.com/biomejs/biome/blob/main/crates/biome_js_analyze/tests/specs/suspicious/noExplicitAny)

</TabItem>
</Tabs>