docgen: support both constructor and call expressions

This commit is contained in:
Patrik Oldsberg
2020-07-15 11:48:01 +02:00
parent e692991226
commit 7a5f4bcbd4
+6 -2
View File
@@ -97,7 +97,11 @@ export default class TypeLocator {
private getExportedConstructorDeclaration(
node: ts.Node,
):
| { constructorType: ts.Type; initializer: ts.NewExpression; name: string }
| {
constructorType: ts.Type;
initializer: ts.CallExpression | ts.NewExpression;
name: string;
}
| undefined {
if (!ts.isVariableStatement(node)) {
return undefined;
@@ -119,7 +123,7 @@ export default class TypeLocator {
if (!initializer || !name) {
return undefined;
}
if (!ts.isNewExpression(initializer)) {
if (!ts.isCallOrNewExpression(initializer)) {
return undefined;
}
if (!ts.isIdentifier(name)) {