0e311e3918
The new version of `dgeni-packages/typescript` no longer strips out "namespaces" from types, which was part of the problem of not autolinking correctly to `HttpEventType.Response`. Another part of the problem was that we did not include `.` characters when matching potential code blocks for auto-linking, which precluded properties of enums from being linked. Finally, members we not being given a `path` property, which is needed to effectively autolink to them. This is now set in the `simplifyMemberAnchors` processor. Closes #21375 PR Close #22494
33 lines
1001 B
JavaScript
33 lines
1001 B
JavaScript
/**
|
|
* Members that have overloads get long unwieldy anchors because they must be distinguished
|
|
* by their parameter lists.
|
|
* But the primary overload doesn't not need this distinction, so can just be the name of the member.
|
|
*/
|
|
module.exports = function simplifyMemberAnchors() {
|
|
return {
|
|
$runAfter: ['paths-computed'],
|
|
$runBefore: ['rendering-docs'],
|
|
$process: function(docs) {
|
|
return docs.forEach(doc => {
|
|
if (doc.members) {
|
|
doc.members.forEach(member => {
|
|
member.anchor = computeAnchor(member);
|
|
member.path = doc.path + '#' + member.anchor;
|
|
});
|
|
}
|
|
if (doc.statics) {
|
|
doc.statics.forEach(member => {
|
|
member.anchor = computeAnchor(member);
|
|
member.path = doc.path + '#' + member.anchor;
|
|
});
|
|
}
|
|
});
|
|
}
|
|
};
|
|
};
|
|
|
|
function computeAnchor(member) {
|
|
// if the member is a "call" type then it has no name
|
|
return encodeURI(member.name.trim() || 'call');
|
|
}
|