@@ -203,26 +203,13 @@ namespace ts.GoToDefinition {
203203 if ( ! signatureDeclarations ) {
204204 return undefined ;
205205 }
206- const declarations = signatureDeclarations . filter ( selectConstructors ? isConstructorDeclaration : isSignatureDeclaration ) ;
206+ const declarations = signatureDeclarations . filter ( selectConstructors ? isConstructorDeclaration : isFunctionLike ) ;
207207 return declarations . length
208208 ? [ createDefinitionInfo ( find ( declarations , d => ! ! ( < FunctionLikeDeclaration > d ) . body ) || last ( declarations ) , typeChecker , symbol , node ) ]
209209 : undefined ;
210210 }
211211 }
212212
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-
226213 /** Creates a DefinitionInfo from a Declaration, using the declaration's name if possible. */
227214 function createDefinitionInfo ( declaration : Declaration , checker : TypeChecker , symbol : Symbol , node : Node ) : DefinitionInfo {
228215 const symbolName = checker . symbolToString ( symbol ) ; // Do not get scoped name, just the name of the symbol
@@ -278,13 +265,7 @@ namespace ts.GoToDefinition {
278265 function tryGetSignatureDeclaration ( typeChecker : TypeChecker , node : Node ) : SignatureDeclaration | undefined {
279266 const callLike = getAncestorCallLikeExpression ( node ) ;
280267 const signature = callLike && typeChecker . getResolvedSignature ( callLike ) ;
281- if ( signature ) {
282- const decl = signature . declaration ;
283- if ( decl && isSignatureDeclaration ( decl ) ) {
284- return decl ;
285- }
286- }
287268 // 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 ) ) ;
289270 }
290271}
0 commit comments