Merge branch 'fix11857' of https://github.com/RyanCavanaugh/TypeScript into RyanCavanaugh-fix11857

This commit is contained in:
Mohamed Hegazy
2017-10-14 11:31:39 -07:00
2 changed files with 25 additions and 3 deletions

View File

@@ -16852,9 +16852,10 @@ namespace ts {
// in a JS file
// Note:JS inferred classes might come from a variable declaration instead of a function declaration.
// In this case, using getResolvedSymbol directly is required to avoid losing the members from the declaration.
const funcSymbol = node.expression.kind === SyntaxKind.Identifier ?
getResolvedSymbol(node.expression as Identifier) :
checkExpression(node.expression).symbol;
let funcSymbol = checkExpression(node.expression).symbol;
if (!funcSymbol && node.expression.kind === SyntaxKind.Identifier) {
funcSymbol = getResolvedSymbol(node.expression as Identifier);
}
const type = funcSymbol && getJavaScriptClassType(funcSymbol);
if (type) {
return type;