const
interpreted as function typed via an interface
declaration, yield unexpected comment summaries #2521
Closed
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
fooWithoutComment
to copy the comment summary and signatures (including their comment summaries) fromFoo
.fooWithComment
to override the comment summary, with "New comment." but copy the signatures (including their comment summaries) fromFoo
.
Actual Behavior
These are screenshots of the resulting documentation:
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