R15BREAKINGfunction

Overload Removed

Flags when a function overload signature is removed. Callers using the removed overload will fail to compile.


Applies to

TypeScriptJava

Why it matters

Function overloads define multiple call signatures. Removing one invalidates callers that rely on that specific argument combination.

Example

Before (two overloads)
// parser.ts
export function parse(input: string): AST;
export function parse(input: Buffer): AST;
export function parse(input: string | Buffer): AST { ... }
After (Buffer overload removed)
// parser.ts (BREAKING — Buffer overload removed)
export function parse(input: string): AST;
export function parse(input: string): AST { ... }

What you see in the terminal

$ npx dg check

  [BREAKING] parse (signature_change)
  src/parser.ts:2
  Function overload was removed. Callers using the removed overload will fail.

How detection works

The classifier compares the overload count between old and new signatures. If the new signature has fewer overloads, the rule fires.

Real-world scenario

A library removes the Buffer overload of a parse function. Callers passing Buffers will get a TypeScript error.

Edge cases

  • Only applies to TypeScript and Java — Go, Rust, and Python don't have overloads
  • Removing all overloads and keeping just the implementation signature is caught