Skip to content

Latest commit

 

History

History
39 lines (26 loc) · 868 Bytes

unified-signatures.md

File metadata and controls

39 lines (26 loc) · 868 Bytes

Warns for any two overloads that could be unified into one by using a union or an optional/rest parameter (unified-signatures)

Warns for any two overloads that could be unified into one by using a union or an optional/rest parameter.

Rule Details

This rule aims to keep the source code as maintainable as possible by reducing the amount of overloads.

Examples of incorrect code for this rule:

function f(x: number): void;
function f(x: string): void;
f(): void;
f(...x: number[]): void;

Examples of correct code for this rule:

function f(x: number | string): void;
function f(x?: ...number[]): void;

Related to

Attributes

  • ✅ Recommended
  • 🔧 Fixable
  • 💭 Requires type information