chore(doc-gen): improve error handling for missing declaration params
This commit is contained in:
parent
398e70ad39
commit
8c409e9251
|
@ -153,13 +153,14 @@ module.exports = function readTypeScriptModules(tsParser, readFilesProcessor, mo
|
||||||
return memberDoc;
|
return memberDoc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function getParameters(typeChecker, symbol) {
|
function getParameters(typeChecker, symbol) {
|
||||||
var declaration = symbol.valueDeclaration || symbol.declarations[0];
|
var declaration = symbol.valueDeclaration || symbol.declarations[0];
|
||||||
var sourceFile = ts.getSourceFileOfNode(declaration);
|
var sourceFile = ts.getSourceFileOfNode(declaration);
|
||||||
if(!declaration.parameters) {
|
if(!declaration.parameters) {
|
||||||
console.log(declaration);
|
var location = getLocation(symbol);
|
||||||
throw 'missing declaration parameters';
|
throw new Error('missing declaration parameters for "' + symbol.name +
|
||||||
|
'" in ' + sourceFile.fileName +
|
||||||
|
' at line ' + location.start.line);
|
||||||
}
|
}
|
||||||
var signature = typeChecker.getSignatureFromDeclaration(declaration);
|
var signature = typeChecker.getSignatureFromDeclaration(declaration);
|
||||||
return declaration.parameters.map(function(parameter) {
|
return declaration.parameters.map(function(parameter) {
|
||||||
|
|
Loading…
Reference in New Issue