mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 16:38:05 -06:00
Fix bugs for go-to-definition on mapped type method (#25991)
This commit is contained in:
parent
998c911c49
commit
0e5af11625
@ -34,12 +34,12 @@ namespace ts.GoToDefinition {
|
||||
// For a function, if this is the original function definition, return just sigInfo.
|
||||
// If this is the original constructor definition, parent is the class.
|
||||
if (typeChecker.getRootSymbols(symbol).some(s => symbolMatchesSignature(s, calledDeclaration)) ||
|
||||
// TODO: GH#23742 Following check shouldn't be necessary if 'require' is an alias
|
||||
symbol.declarations.some(d => isVariableDeclaration(d) && !!d.initializer && isRequireCall(d.initializer, /*checkArgumentIsStringLiteralLike*/ false))) {
|
||||
// TODO: GH#25533 Following check shouldn't be necessary if 'require' is an alias
|
||||
symbol.declarations && symbol.declarations.some(d => isVariableDeclaration(d) && !!d.initializer && isRequireCall(d.initializer, /*checkArgumentIsStringLiteralLike*/ false))) {
|
||||
return [sigInfo];
|
||||
}
|
||||
else {
|
||||
const defs = getDefinitionFromSymbol(typeChecker, symbol, node)!;
|
||||
const defs = getDefinitionFromSymbol(typeChecker, symbol, node) || emptyArray;
|
||||
// For a 'super()' call, put the signature first, else put the variable first.
|
||||
return node.kind === SyntaxKind.SuperKeyword ? [sigInfo, ...defs] : [...defs, sigInfo];
|
||||
}
|
||||
|
||||
7
tests/cases/fourslash/goToDefinition_mappedType.ts
Normal file
7
tests/cases/fourslash/goToDefinition_mappedType.ts
Normal file
@ -0,0 +1,7 @@
|
||||
///<reference path="fourslash.ts"/>
|
||||
|
||||
////interface I { /*def*/m(): void; };
|
||||
////declare const i: { [K in "m"]: I[K] };
|
||||
////i.[|/*ref*/m|]();
|
||||
|
||||
verify.goToDefinition("ref", "def");
|
||||
Loading…
x
Reference in New Issue
Block a user