diff --git a/src/lib/converter/comments/parser.ts b/src/lib/converter/comments/parser.ts index eea8bb4b1..6fcf65fd3 100644 --- a/src/lib/converter/comments/parser.ts +++ b/src/lib/converter/comments/parser.ts @@ -215,7 +215,10 @@ function blockTag( let content: CommentDisplayPart[]; if (tagName === "@example" && config.jsDocCompatibility.exampleTag) { content = exampleBlockContent(comment, lexer, config, warning); - } else if (tagName === "@default" && config.jsDocCompatibility.defaultTag) { + } else if ( + (tagName === "@default" && config.jsDocCompatibility.defaultTag) || + tagName === "@defaultValue" + ) { content = defaultBlockContent(comment, lexer, config, warning); } else { content = blockContent(comment, lexer, config, warning); diff --git a/src/test/behavior.c2.test.ts b/src/test/behavior.c2.test.ts index 177568362..181802eb3 100644 --- a/src/test/behavior.c2.test.ts +++ b/src/test/behavior.c2.test.ts @@ -277,6 +277,19 @@ describe("Behavior Tests", () => { logger.expectNoOtherMessages(); }); + it("Handles @defaultValue tags", () => { + const project = convert("defaultValueTag"); + const foo = query(project, "foo"); + const tags = foo.comment?.blockTags.map((tag) => tag.content); + + equal(tags, [ + [{ kind: "code", text: "```ts\n\n```" }], + [{ kind: "code", text: "```ts\nfn({})\n```" }], + ]); + + logger.expectNoOtherMessages(); + }); + it("Handles @example tags with JSDoc compat turned on", () => { const project = convert("exampleTags"); const foo = query(project, "foo"); diff --git a/src/test/converter2/behavior/defaultValueTag.ts b/src/test/converter2/behavior/defaultValueTag.ts new file mode 100644 index 000000000..3823d6667 --- /dev/null +++ b/src/test/converter2/behavior/defaultValueTag.ts @@ -0,0 +1,5 @@ +/** + * @defaultValue + * @defaultValue fn({}) + */ +export const foo = 1;