Open
Description
Consider the following TypeScript source file:
/** [1]
* @file Copyright (c) Example Corporation
*/
/** [2]
* The Widget class
*/
// [3] TODO: This class needs to be refactored
export class Widget {
/** [4]
* The width of the Widget class
*/
// [5] private width: string;
/* [6] Renders the class */
public render(): void {
}
/**
* [7] The height of the widget
*/
public get height(): number {
}
// [8] This is a setter for the above getter
/**
* [9] Sets the height
*/
public set height(value: number) {
}
}
Which comments are associated with which API items?
We might expect a documentation tool to associate the comments as follows:
- Widget: Uses [2] as its doc comment
- Widget.render: No doc comment, but warn that [6] looks like it was intended to be JSDoc, and warn that [4] doesn't seem to be attached to anything
- Widget.height: Normally setters/getters are documented as one API item, so use [7] and report a warning for [9]
Does this make sense? Is there an unambiguous algorithm for selecting the right comment?