Skip to content

Commit 5cb84f3

Browse files
authored
fix(dgeni): type alias symbols don't get link tag added (#3110)
1 parent 8743e69 commit 5cb84f3

File tree

2 files changed

+20
-14
lines changed

2 files changed

+20
-14
lines changed

tools/dgeni/src/processors/addLinkTagToDaffodilReferences.ts

+14-8
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import {
33
Document,
44
} from 'dgeni';
55

6+
import { CollectLinkableSymbolsProcessor } from './collect-linkable-symbols';
7+
68
/**
79
* Adds a link tag ({@link }) around daffodil models, classes, etc.
810
*/
@@ -12,6 +14,8 @@ export class AddLinkTagToDaffodilReferencesProcessor implements Processor {
1214
$runBefore = ['rendering-docs'];
1315

1416
$process(docs: Document[]): Document[] {
17+
console.log(CollectLinkableSymbolsProcessor.symbols);
18+
1519
const docDictionary = docs.reduce((acc, doc) => ({
1620
...acc,
1721
[doc.name]: true,
@@ -21,14 +25,16 @@ export class AddLinkTagToDaffodilReferencesProcessor implements Processor {
2125
}
2226

2327
addLinksToDoc(doc, docDictionary): Document {
24-
return {
25-
...doc,
26-
typeParams: this.addLinks(doc.typeParams?.slice(1, doc.typeParams.length - 1), docDictionary),
27-
members: doc.members?.map(member => ({
28-
...member,
29-
type: this.addLinks(member.type, docDictionary),
30-
})),
31-
};
28+
doc.typeParams = this.addLinks(doc.typeParams?.slice(1, doc.typeParams.length - 1), docDictionary);
29+
if (doc.typeDefinition) {
30+
doc.typeDefinition = this.addLinks(doc.typeDefinition, docDictionary);
31+
}
32+
doc.members = doc.members?.map(member => ({
33+
...member,
34+
type: this.addLinks(member.type, docDictionary),
35+
}));
36+
37+
return doc;
3238
}
3339

3440
addLinks(str: string, docDictionary): string {

tools/dgeni/src/processors/breadcrumb.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -156,13 +156,13 @@ export class BreadcrumbProcessor implements FilterableProcessor {
156156
return breadcrumbs;
157157
}
158158

159-
$process(docs: Array<ParentedDocument & KindedDocument>): Array<BreadcrumbedDocument> {
160-
return docs.map(doc => ({
161-
...doc,
162-
breadcrumbs: this.docTypes.includes(doc.docType)
159+
$process(docs: Array<ParentedDocument & KindedDocument>): Array<ParentedDocument & KindedDocument & BreadcrumbedDocument> {
160+
return docs.map(doc => {
161+
doc.breadcrumbs = this.docTypes.includes(doc.docType)
163162
? this.getBreadcrumbs(doc)
164-
: [],
165-
}));
163+
: [];
164+
return <ParentedDocument & KindedDocument & BreadcrumbedDocument>doc;
165+
});
166166
}
167167
};
168168

0 commit comments

Comments
 (0)