Skip to content

Commit

Permalink
Fix #2594
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerrit0 committed Jun 16, 2024
1 parent 01917be commit ad1779b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/lib/converter/comments/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ function getCommentImpl(
files,
);

if (comment?.getTag("@import") || comment?.getTag("@license")) {
return;
}

if (moduleComment && comment) {
// Module comment, make sure it is tagged with @packageDocumentation or @module.
// If it isn't then the comment applies to the first statement in the file, so throw it away.
Expand Down
3 changes: 2 additions & 1 deletion src/test/converter2/issues/gh2552.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@
* @module good-module
*/

export function goodFunction() {}
/** @import * as ts2 from "typescript" */
export const something = 1;
3 changes: 2 additions & 1 deletion src/test/issues.c2.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1486,12 +1486,13 @@ describe("Issue Tests", () => {
equal(getSigComment(project, "fooWithComment", 1), "Overload 2");
});

it("Ignores @license and @import comments at the top of the file, #2552", () => {
it("Ignores @license and @import comments, #2552", () => {
const project = convert();
equal(
Comment.combineDisplayParts(project.comment?.summary),
"This is an awesome module.",
);
equal(getComment(project, "something"), "");
});

it("Does not warn about documented constructor signature type aliases, #2553", () => {
Expand Down

0 comments on commit ad1779b

Please sign in to comment.