mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-07 14:34:35 -06:00
Avoid the class declaration not found assert when the new expression doesnt contain construct signature
This commit is contained in:
parent
35450d3451
commit
dab0dbe6f0
@ -191,7 +191,7 @@ namespace ts.GoToDefinition {
|
||||
function getConstructSignatureDefinition(): DefinitionInfo[] | undefined {
|
||||
// Applicable only if we are in a new expression, or we are on a constructor declaration
|
||||
// and in either case the symbol has a construct signature definition, i.e. class
|
||||
if (isNewExpressionTarget(node) || node.kind === SyntaxKind.ConstructorKeyword && symbol.flags & SymbolFlags.Class) {
|
||||
if (symbol.flags & SymbolFlags.Class && (isNewExpressionTarget(node) || node.kind === SyntaxKind.ConstructorKeyword)) {
|
||||
const cls = find(symbol.declarations, isClassLike) || Debug.fail("Expected declaration to have at least one class-like declaration");
|
||||
return getSignatureDefinition(cls.members, /*selectConstructors*/ true);
|
||||
}
|
||||
|
||||
@ -5,6 +5,12 @@
|
||||
////let I: {
|
||||
//// /*constructSignature*/new(): C2;
|
||||
////};
|
||||
////let C = new [|/*invokeExpression*/I|]();
|
||||
////new [|/*invokeExpression1*/I|]();
|
||||
////let /*symbolDeclaration*/I2: {
|
||||
////};
|
||||
////new [|/*invokeExpression2*/I2|]();
|
||||
|
||||
verify.goToDefinition("invokeExpression", "constructSignature");
|
||||
verify.goToDefinition({
|
||||
invokeExpression1: "constructSignature",
|
||||
invokeExpression2: "symbolDeclaration"
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user