We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cbc112a commit c8cd748Copy full SHA for c8cd748
src/compiler/checker.ts
@@ -2937,6 +2937,14 @@ namespace ts {
2937
}
2938
// Handle module.exports = expr
2939
if (declaration.kind === SyntaxKind.BinaryExpression) {
2940
+ // Use JS Doc type if present on parent expression statement
2941
+ if (declaration.flags & NodeFlags.JavaScriptFile) {
2942
+ const typeTag = getJSDocTypeTag(declaration.parent);
2943
+ if (typeTag && typeTag.typeExpression) {
2944
+ return links.type = getTypeFromTypeNode(typeTag.typeExpression.type);
2945
+ }
2946
2947
+
2948
return links.type = getUnionType(map(symbol.declarations, (decl: BinaryExpression) => checkExpressionCached(decl.right)));
2949
2950
if (declaration.kind === SyntaxKind.PropertyAccessExpression) {
0 commit comments