@@ -203,26 +203,13 @@ namespace ts.GoToDefinition {
203
203
if ( ! signatureDeclarations ) {
204
204
return undefined ;
205
205
}
206
- const declarations = signatureDeclarations . filter ( selectConstructors ? isConstructorDeclaration : isSignatureDeclaration ) ;
206
+ const declarations = signatureDeclarations . filter ( selectConstructors ? isConstructorDeclaration : isFunctionLike ) ;
207
207
return declarations . length
208
208
? [ createDefinitionInfo ( find ( declarations , d => ! ! ( < FunctionLikeDeclaration > d ) . body ) || last ( declarations ) , typeChecker , symbol , node ) ]
209
209
: undefined ;
210
210
}
211
211
}
212
212
213
- function isSignatureDeclaration ( node : Node ) : boolean {
214
- switch ( node . kind ) {
215
- case SyntaxKind . Constructor :
216
- case SyntaxKind . ConstructSignature :
217
- case SyntaxKind . FunctionDeclaration :
218
- case SyntaxKind . MethodDeclaration :
219
- case SyntaxKind . MethodSignature :
220
- return true ;
221
- default :
222
- return false ;
223
- }
224
- }
225
-
226
213
/** Creates a DefinitionInfo from a Declaration, using the declaration's name if possible. */
227
214
function createDefinitionInfo ( declaration : Declaration , checker : TypeChecker , symbol : Symbol , node : Node ) : DefinitionInfo {
228
215
const symbolName = checker . symbolToString ( symbol ) ; // Do not get scoped name, just the name of the symbol
@@ -278,13 +265,7 @@ namespace ts.GoToDefinition {
278
265
function tryGetSignatureDeclaration ( typeChecker : TypeChecker , node : Node ) : SignatureDeclaration | undefined {
279
266
const callLike = getAncestorCallLikeExpression ( node ) ;
280
267
const signature = callLike && typeChecker . getResolvedSignature ( callLike ) ;
281
- if ( signature ) {
282
- const decl = signature . declaration ;
283
- if ( decl && isSignatureDeclaration ( decl ) ) {
284
- return decl ;
285
- }
286
- }
287
268
// Don't go to a function type, go to the value having that type.
288
- return undefined ;
269
+ return tryCast ( signature && signature . declaration , ( d ) : d is SignatureDeclaration => isFunctionLike ( d ) && ! isFunctionTypeNode ( d ) ) ;
289
270
}
290
271
}
0 commit comments