Skip to content

Commit 215f8dc

Browse files
Amgelo563almeidx
authored andcommitted
fix: Do not omit falsy default values (#10755)
* fix(docs): fix default falsy values being omitted * fix(docs): swap defaultValue check to avoid negated condition * fix: fix pr by removing everything it added and committing something entirely different --------- Co-authored-by: almeidx <[email protected]>
1 parent b6089e5 commit 215f8dc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/api-extractor/src/generators/ApiModelGenerator.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1270,7 +1270,7 @@ export class ApiModelGenerator {
12701270
const apiItemMetadata: ApiItemMetadata = this._collector.fetchApiItemMetadata(astDeclaration);
12711271
const docComment: tsdoc.DocComment | undefined = jsDoc
12721272
? this._tsDocParser.parseString(
1273-
`/**\n * ${this._fixLinkTags(jsDoc.description) ?? ''}${jsDoc.default ? ` (default: ${this._escapeSpecialChars(jsDoc.default)})` : ''}\n${
1273+
`/**\n * ${this._fixLinkTags(jsDoc.description) ?? ''}${jsDoc.default === undefined ? '' : ` (default: ${this._escapeSpecialChars(jsDoc.default)})`}\n${
12741274
'see' in jsDoc ? jsDoc.see.map((see) => ` * @see ${see}\n`).join('') : ''
12751275
}${'readonly' in jsDoc && jsDoc.readonly ? ' * @readonly\n' : ''}${
12761276
'deprecated' in jsDoc && jsDoc.deprecated
@@ -1348,7 +1348,7 @@ export class ApiModelGenerator {
13481348
const apiItemMetadata: ApiItemMetadata = this._collector.fetchApiItemMetadata(astDeclaration);
13491349
const docComment: tsdoc.DocComment | undefined = jsDoc
13501350
? this._tsDocParser.parseString(
1351-
`/**\n * ${this._fixLinkTags(jsDoc.description) ?? ''}${jsDoc.default ? `\n * @defaultValue ${this._escapeSpecialChars(jsDoc.default)}` : ''}\n${
1351+
`/**\n * ${this._fixLinkTags(jsDoc.description) ?? ''}${jsDoc.default === undefined ? '' : `\n * @defaultValue ${this._escapeSpecialChars(jsDoc.default)}`}\n${
13521352
'see' in jsDoc ? jsDoc.see.map((see) => ` * @see ${see}\n`).join('') : ''
13531353
}${'readonly' in jsDoc && jsDoc.readonly ? ' * @readonly\n' : ''}${
13541354
'deprecated' in jsDoc && jsDoc.deprecated

0 commit comments

Comments
 (0)