no-empty-object-type
Configuration
rslint.config.ts
Rule Details
Disallows accidental uses of the {} ("empty object") type. In TypeScript {} is the type of any non-nullish value, which is rarely what authors intend — typically they want object (any non-primitive value) or unknown (any value at all). The same problem applies to empty interface declarations: an empty interface with no members is equivalent to {}, and an empty interface that extends a single supertype is equivalent to a type alias of that supertype.
This rule reports both shapes and offers object / unknown suggestions.
Examples of incorrect code for this rule:
Examples of correct code for this rule:
Options
allowInterfaces(default"never"): how empty interfaces are treated."never": empty interfaces are disallowed."always": empty interfaces are always allowed."with-single-extends": empty interfaces are allowed only when they extend exactly one supertype.
allowObjectTypes(default"never"): how empty{}type literals are treated."never": empty{}is disallowed."always": empty{}is always allowed.
allowWithName: a regular expression source string. When set, interfaces andtypealiases whose name matches the pattern are exempted.
allowInterfaces: "with-single-extends"
Examples of correct code:
allowObjectTypes: "always"
Examples of correct code:
allowWithName: "Props$"
Examples of correct code: