Skip to content

Latest commit

 

History

History
43 lines (28 loc) · 875 Bytes

unified-signatures.md

File metadata and controls

43 lines (28 loc) · 875 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 code for this rule:

❌ Incorrect

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

✅ Correct

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

Related To

Attributes

  • ✅ Recommended
  • 🔧 Fixable
  • 💭 Requires type information