File tree Expand file tree Collapse file tree 2 files changed +25
-3
lines changed Expand file tree Collapse file tree 2 files changed +25
-3
lines changed Original file line number Diff line number Diff line change @@ -16852,9 +16852,10 @@ namespace ts {
16852
16852
// in a JS file
16853
16853
// Note:JS inferred classes might come from a variable declaration instead of a function declaration.
16854
16854
// 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
+ }
16858
16859
const type = funcSymbol && getJavaScriptClassType(funcSymbol);
16859
16860
if (type) {
16860
16861
return type;
Original file line number Diff line number Diff line change
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' ) ;
You can’t perform that action at this time.
0 commit comments