Skip to content

Commit 9262727

Browse files
committed
feat(docs): export type info for var and const exports
Closes #3700
1 parent 3963e0a commit 9262727

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

docs/angular.io-package/processors/addJadeDataDocsProcessor.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ module.exports = function addJadeDataDocsProcessor() {
5151
var modulePageInfo = _.map(doc.exports, function(exportDoc) {
5252
return {
5353
name: exportDoc.name + '-' + exportDoc.docType,
54-
title: exportDoc.name
54+
title: exportDoc.name,
55+
varType: exportDoc.symbolTypeName && titleCase(exportDoc.symbolTypeName)
5556
};
5657
});
5758

docs/angular.io-package/templates/jade-data.template.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
{%- for item in doc.data %}
33
"{$ item.name $}" : {
44
"title" : "{$ item.title $}"{% if item.intro %},
5-
"intro" : "{$ item.intro $}"{% endif %}
5+
"intro" : "{$ item.intro $}"{% endif %}{% if item.varType %},
6+
"varType" : "{$ item.varType $}"{% endif %}
67
}{% if not loop.last %},{% endif %}
78
{% endfor -%}
8-
}
9+
}

docs/typescript-package/processors/readTypeScriptModules.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,12 @@ module.exports = function readTypeScriptModules(tsParser, modules, getFileInfo,
188188
location: getLocation(exportSymbol)
189189
};
190190

191+
if (exportDoc.docType === 'var' || exportDoc.docType === 'const') {
192+
exportDoc.symbolTypeName = exportSymbol.valueDeclaration.type &&
193+
exportSymbol.valueDeclaration.type.typeName &&
194+
exportSymbol.valueDeclaration.type.typeName.text;
195+
}
196+
191197
if(exportSymbol.flags & ts.SymbolFlags.Function) {
192198
exportDoc.parameters = getParameters(typeChecker, exportSymbol);
193199
}

0 commit comments

Comments
 (0)