unified-signatures
Added in v0.1.14Configuration
rslint.config.ts
Disallow overloads that can be combined into one signature with a union, optional parameter, or rest parameter.
Rule details
Multiple overloads make an API harder to read when they differ only in a single parameter type or in one parameter that can be omitted. This rule reports those signatures and recommends expressing the difference directly.
Examples of incorrect code for this rule:
Examples of correct code for this rule:
The last pair is allowed because its return types differ.
Options
The rule accepts an optional object:
ignoreDifferentlyNamedParameters
When true, overloads whose corresponding parameters have different names
are not combined.
ignoreOverloadsWithDifferentJSDoc
When true, overloads with different preceding block comments are not
combined.