Skip to content

Overload docs in interface aren't correctly inherited in concrete implementations #2755

@manticorp

Description

@manticorp

Search terms

overload, interface

Expected Behavior

Overloaded functions in concrete class implementations should inherit the correct documentation from the interface

Actual Behavior

It seems as if only the first overload in the interface gets inherited to all overloads in the concrete implementation

Steps to reproduce the bug

Here is a gist

(note you don't need the abstract class, it occurs with just the interface and concrete)

Here is some minimal code:

interface Test {
  /**
   * Provide a string and I will give you a boolean
   *
   * @example
   * concrete.myFunc('str'); // false
   */
  myFunc (a: string) : boolean;

  /**
   * Pass me a number and I will give you a number
   *
   * @example
   * concrete.myFunc(5); // 1
   */
  myFunc (a: number) : number;


  /**
   * Pass me a string and I will give you a number
   *
   * @example
   * concrete.myFunc('str'); // 1
   */
  anotherFunc (a: string) : number;

  /**
   * Pass me a number and I will give you a boolean
   *
   * @example
   * concrete.myFunc(5); // false
   */
  anotherFunc (a: number) : boolean;
}

class ConcreteTest implements Test {
  myFunc (a: string) : boolean;
  myFunc (a: number) : number;
  myFunc (a: string | number): number | boolean {
    if (typeof a === 'string') {
      return false;
    }
    return 1;
  }

  anotherFunc (a: string) : number;
  anotherFunc (a: number) : boolean;
  anotherFunc (a: string | number): number | boolean {
    if (typeof a === 'string') {
      return 1;
    }
    return false;
  }
}

Here is the result - in the interface, the docs are correct:

image

But in the concrete implementation, the docs are incorrect:

image

Environment

  • Typedoc version: 0.26.10
  • TypeScript version: 5.6.3
  • Node.js version: 20.13.1
  • OS: Windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions