t `Record` instead.', '- If you really want a type meaning "any non-nullish value", you probably want `NonNullable` instead.', ].join('\n'), suggest: [ 'object', 'unknown', 'Record', 'NonNullable', ], }, }; ``` ### `types` An object whose keys are the types you want to ban, and the values are error messages. The type can either be a type name literal (`Foo`), a type name with generic parameter instantiation(s) (`Foo`), the empty object literal (`{}`), or the empty tuple type (`[]`). The values can be: - A string, which is the error message to be reported; or - `false` to specifically un-ban this type (useful when you are using `extendDefaults`); or - An object with the following properties: - `message: string` - the message to display when the type is matched. - `fixWith?: string` - a string to replace the banned type with when the fixer is run. If this is omitted, no fix will be done. - `suggest?: string[]` - a list of suggested replacements for the banned type. ### `extendDefaults` If you're specifying custom `types`, you can set this to `true` to extend the default `types` configuration. This is a convenience option to save you copying across the defaults when adding another type. If this is `false`, the rule will _only_ use the types defined in your configuration. Example configuration: ```jsonc { "@typescript-eslint/ban-types": [ "error", { "types": { // add a custom message to help explain why not to use it "Foo": "Don't use Foo because it is unsafe", // add a custom message, AND tell the plugin how to fix it "OldAPI": { "message": "Use NewAPI instead", "fixWith": "NewAPI" }, // un-ban a type that's banned by default "{}": false }, "extendDefaults": true } ] } ```