JS class members as methods

This commit is contained in:
Ryan Cavanaugh
2015-10-27 17:17:31 -07:00
parent b31b45f584
commit bc3d95c0a4
2 changed files with 6 additions and 1 deletions

View File

@@ -1063,7 +1063,7 @@ namespace ts {
// Get 'y', the property name, and add it to the type of the class
let propertyName = (<PropertyAccessExpression>node.left).name;
let prototypeSymbol = declareSymbol(funcSymbol.members, funcSymbol, <PropertyAccessExpression>(<PropertyAccessExpression>node.left).expression, SymbolFlags.HasMembers, SymbolFlags.None);
declareSymbol(prototypeSymbol.members, prototypeSymbol, <PropertyAccessExpression>node.left, SymbolFlags.Method | SymbolFlags.Property, SymbolFlags.None);
declareSymbol(prototypeSymbol.members, prototypeSymbol, <PropertyAccessExpression>node.left, SymbolFlags.Method, SymbolFlags.None);
}
function bindCallExpression(node: CallExpression) {

View File

@@ -3843,6 +3843,11 @@ namespace ts {
}
}
result.push(getSignatureFromDeclaration(<SignatureDeclaration>node));
break;
case SyntaxKind.PropertyAccessExpression:
// Class inference from ClassName.prototype.methodName = expr
return getSignaturesOfType(checkExpressionCached((<BinaryExpression>node.parent).right), SignatureKind.Call);
}
}
return result;