diff --git a/common/changes/@microsoft/tsdoc/default-value-inline-content_2024-09-12-09-25.json b/common/changes/@microsoft/tsdoc/default-value-inline-content_2024-09-12-09-25.json new file mode 100644 index 00000000..d0c6e57b --- /dev/null +++ b/common/changes/@microsoft/tsdoc/default-value-inline-content_2024-09-12-09-25.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@microsoft/tsdoc", + "comment": "Ensure TSDocEmitter does not emit a newline for the text after `@defaultValue` tags.", + "type": "patch" + } + ], + "packageName": "@microsoft/tsdoc" +} \ No newline at end of file diff --git a/tsdoc/src/emitters/TSDocEmitter.ts b/tsdoc/src/emitters/TSDocEmitter.ts index 298146a9..1d2d5e6f 100644 --- a/tsdoc/src/emitters/TSDocEmitter.ts +++ b/tsdoc/src/emitters/TSDocEmitter.ts @@ -102,7 +102,10 @@ export class TSDocEmitter { this._ensureLineSkipped(); this._renderNode(docBlock.blockTag); - if (docBlock.blockTag.tagNameWithUpperCase === StandardTags.returns.tagNameWithUpperCase) { + if ( + docBlock.blockTag.tagNameWithUpperCase === StandardTags.returns.tagNameWithUpperCase || + docBlock.blockTag.tagNameWithUpperCase === StandardTags.defaultValue.tagNameWithUpperCase + ) { this._writeContent(' '); this._hangingParagraph = true; } diff --git a/tsdoc/src/emitters/__tests__/TSDocEmitter.test.ts b/tsdoc/src/emitters/__tests__/TSDocEmitter.test.ts index 5216452a..055e9315 100644 --- a/tsdoc/src/emitters/__tests__/TSDocEmitter.test.ts +++ b/tsdoc/src/emitters/__tests__/TSDocEmitter.test.ts @@ -84,6 +84,7 @@ test('02 Emit a basic comment', () => { * line1 * line2 * \`\`\` + * @defaultValue value * * @public @readonly */ @@ -114,6 +115,8 @@ Object { * line2 * \`\`\` * + * @defaultValue value + * * @public @readonly */ ",