Skip to content

Commit 8f94288

Browse files
committed
Fix #3012
1 parent df88357 commit 8f94288

File tree

6 files changed

+33
-0
lines changed

6 files changed

+33
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ title: Changelog
77
### Bug Fixes
88

99
- Fixed bug introduced in 0.28.8 where TypeDoc could not render docs with some mixin classes, #3007.
10+
- `@inheritDoc` will now correctly overwrite `@remarks` and `@returns` blocks on the target comment, #3012.
1011

1112
## v0.28.12 (2025-09-01)
1213

src/lib/converter/comments/parser.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,13 @@ function postProcessComment(
346346
),
347347
);
348348
}
349+
if ((inlineInheritDoc.length || inheritDoc.length) && returns.length) {
350+
warning(
351+
i18n.content_in_returns_block_overwritten_by_inheritdoc_in_comment_at_0(
352+
getPosition(),
353+
),
354+
);
355+
}
349356
}
350357

351358
const aliasedTags = new Map([["@return", "@returns"]]);

src/lib/converter/plugins/InheritDocPlugin.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ export class InheritDocPlugin extends ConverterComponent {
150150
}
151151

152152
target.comment.removeTags("@inheritDoc");
153+
target.comment.removeTags("@remarks");
154+
target.comment.removeTags("@returns");
153155
target.comment.summary = Comment.cloneDisplayParts(
154156
source.comment.summary,
155157
);

src/lib/internationalization/locales/en.cts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ export = {
8181
"Content in the summary section will be overwritten by the @inheritDoc tag in comment at {0}",
8282
content_in_remarks_block_overwritten_by_inheritdoc_in_comment_at_0:
8383
"Content in the @remarks block will be overwritten by the @inheritDoc tag in comment at {0}",
84+
content_in_returns_block_overwritten_by_inheritdoc_in_comment_at_0:
85+
"Content in the @returns block will be overwritten by the @inheritDoc tag in comment at {0}",
8486
example_tag_literal_name:
8587
"The first line of an example tag will be taken literally as the example name, and should only contain text",
8688
inheritdoc_tag_properly_capitalized: "The @inheritDoc tag should be properly capitalized",

src/test/converter2/issues/gh3012.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/**
2+
* @remarks DictRemarks
3+
*/
4+
export const DictionarySchema = {};
5+
6+
/**
7+
* {@inheritDoc DictionarySchema}
8+
*
9+
* @remarks
10+
* Alias of {@link DictionarySchema}
11+
*/
12+
export const NullProtoObjectSchema = DictionarySchema;

src/test/issues.c2.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2182,4 +2182,13 @@ describe("Issue Tests", () => {
21822182
ok(x.comment.summary[1].target);
21832183
ok(project.files.resolve(x.comment.summary[1].target, project) === doc);
21842184
});
2185+
2186+
it("#3012 removes @remarks from inheriting comment", () => {
2187+
const project = convert();
2188+
const nullProto = query(project, "NullProtoObjectSchema");
2189+
equal(nullProto.comment?.blockTags.map(t => t.tag), ["@remarks"]);
2190+
equal(nullProto.comment?.blockTags.map(t => Comment.combineDisplayParts(t.content)), ["DictRemarks"]);
2191+
2192+
logger.expectMessage("warn: Content in the @remarks block will be overwritten*");
2193+
});
21852194
});

0 commit comments

Comments
 (0)