fix(Typings): Output public constructors in .d.ts files
Closes #3926. Closes #3963
This commit is contained in:
@ -150,6 +150,7 @@ module.exports = function readTypeScriptModules(tsParser, modules, getFileInfo,
|
||||
function createExportDoc(name, exportSymbol, moduleDoc, basePath, typeChecker) {
|
||||
var typeParamString = '';
|
||||
var heritageString = '';
|
||||
var typeDefinition = '';
|
||||
|
||||
exportSymbol.declarations.forEach(function(decl) {
|
||||
var sourceFile = ts.getSourceFileOfNode(decl);
|
||||
@ -158,6 +159,10 @@ module.exports = function readTypeScriptModules(tsParser, modules, getFileInfo,
|
||||
typeParamString = '<' + getText(sourceFile, decl.typeParameters) + '>';
|
||||
}
|
||||
|
||||
if (decl.symbol.flags & ts.SymbolFlags.TypeAlias) {
|
||||
typeDefinition = getText(sourceFile, decl.type);
|
||||
}
|
||||
|
||||
if (decl.heritageClauses) {
|
||||
decl.heritageClauses.forEach(function(heritage) {
|
||||
|
||||
@ -215,6 +220,9 @@ module.exports = function readTypeScriptModules(tsParser, modules, getFileInfo,
|
||||
if(exportSymbol.flags & ts.SymbolFlags.Value) {
|
||||
exportDoc.returnType = getReturnType(typeChecker, exportSymbol);
|
||||
}
|
||||
if (exportSymbol.flags & ts.SymbolFlags.TypeAlias) {
|
||||
exportDoc.typeDefinition = typeDefinition;
|
||||
}
|
||||
return exportDoc;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user