Skip to content

Commit 1f63fbb

Browse files
committed
Merge branch 'fix11857' of https://github.com/RyanCavanaugh/TypeScript into RyanCavanaugh-fix11857
2 parents 144026c + 1799458 commit 1f63fbb

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

src/compiler/checker.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16852,9 +16852,10 @@ namespace ts {
1685216852
// in a JS file
1685316853
// Note:JS inferred classes might come from a variable declaration instead of a function declaration.
1685416854
// In this case, using getResolvedSymbol directly is required to avoid losing the members from the declaration.
16855-
const funcSymbol = node.expression.kind === SyntaxKind.Identifier ?
16856-
getResolvedSymbol(node.expression as Identifier) :
16857-
checkExpression(node.expression).symbol;
16855+
let funcSymbol = checkExpression(node.expression).symbol;
16856+
if (!funcSymbol && node.expression.kind === SyntaxKind.Identifier) {
16857+
funcSymbol = getResolvedSymbol(node.expression as Identifier);
16858+
}
1685816859
const type = funcSymbol && getJavaScriptClassType(funcSymbol);
1685916860
if (type) {
1686016861
return type;
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/// <reference path="fourslash.ts" />
2+
3+
// @allowJs: true
4+
// @Filename: something.js
5+
//// function TestObj(){
6+
//// this.property = "value";
7+
//// }
8+
//// var constructor = TestObj;
9+
//// var instance = new constructor();
10+
//// instance./*a*/
11+
//// var class2 = function() { };
12+
//// class2.prototype.blah = function() { };
13+
//// var inst2 = new class2();
14+
//// inst2.blah/*b*/;
15+
16+
goTo.marker('a');
17+
verify.completionListContains('property');
18+
edit.backspace();
19+
20+
goTo.marker('b');
21+
verify.quickInfoIs('(property) class2.blah: () => void');

0 commit comments

Comments
 (0)