Skip to content

Commit de4d813

Browse files
authored
Add module readmes to json output (TypeStrong#2500)
* Add module readmes to json output Resolves TypeStrong#2499 * deserialize readme unconditionally
1 parent 33db59c commit de4d813

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/lib/models/reflections/declaration.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@ export class DeclarationReflection extends ContainerReflection {
311311
this.implementedTypes,
312312
),
313313
implementedBy: serializer.toObjectsOptional(this.implementedBy),
314+
readme: Comment.serializeDisplayParts(serializer, this.readme),
314315
};
315316
}
316317

@@ -320,14 +321,15 @@ export class DeclarationReflection extends ContainerReflection {
320321
): void {
321322
super.fromObject(de, obj);
322323

324+
if (obj.readme) {
325+
this.readme = Comment.deserializeDisplayParts(de, obj.readme);
326+
}
327+
323328
// This happens when merging multiple projects together.
324329
// If updating this, also check ProjectReflection.fromObject.
325330
if (obj.variant === "project") {
326331
this.kind = ReflectionKind.Module;
327332
this.packageVersion = obj.packageVersion;
328-
if (obj.readme) {
329-
this.readme = Comment.deserializeDisplayParts(de, obj.readme);
330-
}
331333

332334
de.defer(() => {
333335
for (const [id, sid] of Object.entries(obj.symbolIdMap || {})) {

src/lib/serialization/schema.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ export interface DeclarationReflection
177177
| "getSignature"
178178
| "setSignature"
179179
| "typeParameters"
180+
| "readme"
180181
> {}
181182

182183
/** @category Reflections */

0 commit comments

Comments
 (0)