typescript/ban-types Pedantic ​
What it does ​
This rule bans specific types and can suggest alternatives. Note that it does not ban the corresponding runtime objects from being used.
Why is this bad? ​
Some built-in types have aliases, while some types are considered dangerous or harmful. It's often a good idea to ban certain types to help with consistency and safety.
Examples ​
Examples of incorrect code for this rule:
typescript
let foo: String = "foo";
let bar: Boolean = true;
Examples of correct code for this rule:
typescript
let foo: string = "foo";
let bar: boolean = true;
How to use ​
To enable this rule in the CLI or using the config file, you can use:
bash
oxlint --deny typescript/ban-types
json
{
"rules": {
"typescript/ban-types": "error"
}
}