Actual fix + test
This commit is contained in:
parent
ad62037f25
commit
17994588b2
2 changed files with 24 additions and 0 deletions
|
@ -16377,6 +16377,9 @@ namespace ts {
|
||||||
// Note:JS inferred classes might come from a variable declaration instead of a function declaration.
|
// 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.
|
// In this case, using getResolvedSymbol directly is required to avoid losing the members from the declaration.
|
||||||
let funcSymbol = checkExpression(node.expression).symbol;
|
let funcSymbol = checkExpression(node.expression).symbol;
|
||||||
|
if (!funcSymbol && node.expression.kind === SyntaxKind.Identifier) {
|
||||||
|
funcSymbol = getResolvedSymbol(node.expression as Identifier);
|
||||||
|
}
|
||||||
if (funcSymbol && isDeclarationOfFunctionOrClassExpression(funcSymbol)) {
|
if (funcSymbol && isDeclarationOfFunctionOrClassExpression(funcSymbol)) {
|
||||||
funcSymbol = getSymbolOfNode((<VariableDeclaration>funcSymbol.valueDeclaration).initializer);
|
funcSymbol = getSymbolOfNode((<VariableDeclaration>funcSymbol.valueDeclaration).initializer);
|
||||||
}
|
}
|
||||||
|
|
21
tests/cases/fourslash/indirectClassInstantiation.ts
Normal file
21
tests/cases/fourslash/indirectClassInstantiation.ts
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
/// <reference path="fourslash.ts" />
|
||||||
|
|
||||||
|
// @allowJs: true
|
||||||
|
// @Filename: something.js
|
||||||
|
//// function TestObj(){
|
||||||
|
//// this.property = "value";
|
||||||
|
//// }
|
||||||
|
//// var constructor = TestObj;
|
||||||
|
//// var instance = new constructor();
|
||||||
|
//// instance./*a*/
|
||||||
|
//// var class2 = function() { };
|
||||||
|
//// class2.prototype.blah = function() { };
|
||||||
|
//// var inst2 = new class2();
|
||||||
|
//// inst2.blah/*b*/;
|
||||||
|
|
||||||
|
goTo.marker('a');
|
||||||
|
verify.completionListContains('property');
|
||||||
|
edit.backspace();
|
||||||
|
|
||||||
|
goTo.marker('b');
|
||||||
|
verify.quickInfoIs('(property) class2.blah: () => void');
|
Loading…
Reference in a new issue