Handle JSDoc tags on 'this' properties

This commit is contained in:
Ryan Cavanaugh 2016-03-21 09:23:33 -07:00
parent cbc112a761
commit c8cd748e48

View File

@ -2937,6 +2937,14 @@ namespace ts {
}
// Handle module.exports = expr
if (declaration.kind === SyntaxKind.BinaryExpression) {
// Use JS Doc type if present on parent expression statement
if (declaration.flags & NodeFlags.JavaScriptFile) {
const typeTag = getJSDocTypeTag(declaration.parent);
if (typeTag && typeTag.typeExpression) {
return links.type = getTypeFromTypeNode(typeTag.typeExpression.type);
}
}
return links.type = getUnionType(map(symbol.declarations, (decl: BinaryExpression) => checkExpressionCached(decl.right)));
}
if (declaration.kind === SyntaxKind.PropertyAccessExpression) {