Skip to content

Commit

Permalink
feat(docs): export type info for var and const exports
Browse files Browse the repository at this point in the history
Closes #3700
  • Loading branch information
btford committed Aug 24, 2015
1 parent 3963e0a commit 9262727
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ module.exports = function addJadeDataDocsProcessor() {
var modulePageInfo = _.map(doc.exports, function(exportDoc) {
return {
name: exportDoc.name + '-' + exportDoc.docType,
title: exportDoc.name
title: exportDoc.name,
varType: exportDoc.symbolTypeName && titleCase(exportDoc.symbolTypeName)
};
});

Expand Down
5 changes: 3 additions & 2 deletions docs/angular.io-package/templates/jade-data.template.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
{%- for item in doc.data %}
"{$ item.name $}" : {
"title" : "{$ item.title $}"{% if item.intro %},
"intro" : "{$ item.intro $}"{% endif %}
"intro" : "{$ item.intro $}"{% endif %}{% if item.varType %},
"varType" : "{$ item.varType $}"{% endif %}
}{% if not loop.last %},{% endif %}
{% endfor -%}
}
}
6 changes: 6 additions & 0 deletions docs/typescript-package/processors/readTypeScriptModules.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,12 @@ module.exports = function readTypeScriptModules(tsParser, modules, getFileInfo,
location: getLocation(exportSymbol)
};

if (exportDoc.docType === 'var' || exportDoc.docType === 'const') {
exportDoc.symbolTypeName = exportSymbol.valueDeclaration.type &&
exportSymbol.valueDeclaration.type.typeName &&
exportSymbol.valueDeclaration.type.typeName.text;
}

if(exportSymbol.flags & ts.SymbolFlags.Function) {
exportDoc.parameters = getParameters(typeChecker, exportSymbol);
}
Expand Down

0 comments on commit 9262727

Please sign in to comment.