Skip to content

Commit 63b9411

Browse files
authored
Merge pull request #427 from spike-rabbit/default-value-inline-content
The content after @DefaultValue should remain on the same line
2 parents 984ffd3 + 07deca4 commit 63b9411

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@microsoft/tsdoc",
5+
"comment": "Ensure TSDocEmitter does not emit a newline for the text after `@defaultValue` tags.",
6+
"type": "patch"
7+
}
8+
],
9+
"packageName": "@microsoft/tsdoc"
10+
}

tsdoc/src/emitters/TSDocEmitter.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,10 @@ export class TSDocEmitter {
102102
this._ensureLineSkipped();
103103
this._renderNode(docBlock.blockTag);
104104

105-
if (docBlock.blockTag.tagNameWithUpperCase === StandardTags.returns.tagNameWithUpperCase) {
105+
if (
106+
docBlock.blockTag.tagNameWithUpperCase === StandardTags.returns.tagNameWithUpperCase ||
107+
docBlock.blockTag.tagNameWithUpperCase === StandardTags.defaultValue.tagNameWithUpperCase
108+
) {
106109
this._writeContent(' ');
107110
this._hangingParagraph = true;
108111
}

tsdoc/src/emitters/__tests__/TSDocEmitter.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ test('02 Emit a basic comment', () => {
8484
* line1
8585
* line2
8686
* \`\`\`
87+
* @defaultValue value
8788
*
8889
* @public @readonly
8990
*/
@@ -114,6 +115,8 @@ Object {
114115
* line2
115116
* \`\`\`
116117
*
118+
* @defaultValue value
119+
*
117120
* @public @readonly
118121
*/
119122
",

0 commit comments

Comments
 (0)