Skip to content

const interpreted as function typed via an interface declaration, yield unexpected comment summaries #2521

Closed
@kraenhansen

Description

Search terms

const, variable, function, interface

This seems related to #1523.

Expected Behavior

Given the following interface and two exported const (interpreted as functions because of their type declaration).

/**
 * Original comment.
 */
export interface Foo {
    /** Overload 1 */
    (): void;
    /** Overload 2 */
    (baz: number): void;
}

export const fooWithoutComment: Foo;

/** 
 * New comment.
 */
export const fooWithComment: Foo;

I'd expect

  1. fooWithoutComment to copy the comment summary and signatures (including their comment summaries) from Foo.
  2. fooWithComment to override the comment summary, with "New comment." but copy the signatures (including their comment summaries) from Foo.

Actual Behavior

These are screenshots of the resulting documentation:

Screenshot 2024-03-08 at 22 20 58 Screenshot 2024-03-08 at 22 20 40 Screenshot 2024-03-08 at 22 20 30

Notice how neither fooWithoutComment nor fooWithComment have comment summaries of their own and how all signatures of fooWithComment has all signature comments copied from the declaration instead of being copied from the comments of Foo's signatures.

Steps to reproduce the bug

I found reproducing the bug using the "typedoc-repros" repo a bit too cumbersome, so I hope it's okay I made it a PR to the "typedoc" repo itself instead: #2522

Environment

  • Typedoc version: 0.25.10
  • TypeScript version: 5.3.3
  • Node.js version: v20.10.0
  • OS: macOS 14.3.1

Metadata

Assignees

No one assigned

    Labels

    bugFunctionality does not match expectation

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions