Skip to content

Commit 0b5b0f5

Browse files
committed
feat(docs): add default values for field members
* Not implementing signatures as some option types are very convoluted which introduces a lot of visual noise in Discord channels resolves #226
1 parent ea821cc commit 0b5b0f5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/functions/docs.ts

+6
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,10 @@ function formatItem(_item: any, _package: string, version: string, member?: stri
259259
const lines: string[] = [[head, middlePart, tail].join(' ')];
260260

261261
const summary = item.summary?.summarySection;
262+
const defaultValueBlock = item.summary?.defaultValueBlock;
262263
const deprecationNote = item.summary?.deprecatedBlock;
263264
const example = formatExample(item.summary?.exampleBlocks);
265+
const defaultValue = defaultValueBlock ? formatSummary(defaultValueBlock, _package, version) : null;
264266

265267
if (deprecationNote?.length) {
266268
lines.push(`${bold('[DEPRECATED]')} ${formatSummary(deprecationNote, _package, version)}`);
@@ -274,6 +276,10 @@ function formatItem(_item: any, _package: string, version: string, member?: stri
274276
}
275277
}
276278

279+
if (defaultValue?.length) {
280+
lines.push(`Default value: ${inlineCode(defaultValue)}`);
281+
}
282+
277283
return lines.join('\n');
278284
}
279285

0 commit comments

Comments
 (0)