File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3166,17 +3166,17 @@ namespace ts {
31663166 }
31673167
31683168 let type: Type = undefined;
3169- // Handle module.exports = expr or this.p = expr
3170- if (declaration.kind === SyntaxKind.BinaryExpression) {
3171- type = getUnionType(map(symbol.declarations, (decl: BinaryExpression) => checkExpressionCached(decl.right)));
3172- }
3173- else if (declaration.kind === SyntaxKind.PropertyAccessExpression) {
3174- // Declarations only exist for property access expressions for certain
3175- // special assignment kinds
3176- if (declaration.parent.kind === SyntaxKind.BinaryExpression) {
3177- // Handle exports.p = expr or className.prototype.method = expr
3178- type = checkExpressionCached((<BinaryExpression>declaration.parent ).right);
3179- }
3169+ // Handle certain special assignment kinds, which happen to union across multiple declarations:
3170+ // * module.exports = expr
3171+ // * exports.p = expr
3172+ // * this.p = expr
3173+ // * className.prototype.method = expr
3174+ if (declaration.kind === SyntaxKind.BinaryExpression ||
3175+ declaration.kind === SyntaxKind.PropertyAccessExpression && declaration.parent.kind === SyntaxKind.BinaryExpression) {
3176+ type = getUnionType(map(symbol.declarations,
3177+ decl => decl.kind === SyntaxKind.BinaryExpression ?
3178+ checkExpressionCached((<BinaryExpression>decl ).right) :
3179+ checkExpressionCached((<BinaryExpression>decl.parent).right)));
31803180 }
31813181
31823182 if (type === undefined) {
You can’t perform that action at this time.
0 commit comments