---
# 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: noRestrictedTypes
description: Learn more about noRestrictedTypes
---
import { Tabs, TabItem } from '@astrojs/starlight/components';

<Tabs>
<TabItem label="TypeScript and TSX" icon="seti:typescript">
## Summary
- Rule available since: `v1.9.0`
- Diagnostic Category: [`lint/style/noRestrictedTypes`](/reference/diagnostics#diagnostic-category)
- This rule isn't recommended, so you need to enable it.
- This rule has a [**safe**](/linter/#safe-fixes) fix.
- The default severity of this rule is [**warning**](/reference/diagnostics#warning).
- Sources: 
  - Same as [`@typescript-eslint/no-restricted-types`](https://typescript-eslint.io/rules/no-restricted-types)

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

```
## Description
Disallow user defined types.

This rule allows you to specify type names that you don’t want to use in your application.

To prevent use of commonly misleading types, you can refer to [noBannedTypes](https://biomejs.dev/linter/rules/no-banned-types/)

## Options

Use the options to specify additional types that you want to restrict in your
source code.

```json title='biome.json'
{
	"linter": {
		"rules": {
			"style": {
				"noRestrictedTypes": {
					"options": {
						"types": {
							"Foo": {
								"message": "Only bar is allowed",
								"use": "bar"
							},
							"OldAPI": "Use NewAPI instead"
						}
					}
				}
			}
		}
	}
}

```

In the example above, the rule will emit a diagnostics if `Foo` or `OldAPI` are used.

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

</TabItem>
</Tabs>