@@ -593,16 +593,18 @@ namespace ts.FindAllReferences.Core {
593593 checker . getPropertySymbolOfDestructuringAssignment ( < Identifier > location ) ;
594594 }
595595
596- function isObjectBindingPatternElementWithoutPropertyName ( symbol : Symbol ) : boolean {
596+ function getObjectBindingElementWithoutPropertyName ( symbol : Symbol ) : BindingElement | undefined {
597597 const bindingElement = getDeclarationOfKind < BindingElement > ( symbol , SyntaxKind . BindingElement ) ;
598- return bindingElement &&
598+ if ( bindingElement &&
599599 bindingElement . parent . kind === SyntaxKind . ObjectBindingPattern &&
600- ! bindingElement . propertyName ;
600+ ! bindingElement . propertyName ) {
601+ return bindingElement ;
602+ }
601603 }
602604
603605 function getPropertySymbolOfObjectBindingPatternWithoutPropertyName ( symbol : Symbol , checker : TypeChecker ) : Symbol | undefined {
604- if ( isObjectBindingPatternElementWithoutPropertyName ( symbol ) ) {
605- const bindingElement = getDeclarationOfKind < BindingElement > ( symbol , SyntaxKind . BindingElement ) ;
606+ const bindingElement = getObjectBindingElementWithoutPropertyName ( symbol ) ;
607+ if ( bindingElement ) {
606608 const typeOfPattern = checker . getTypeAtLocation ( bindingElement . parent ) ;
607609 return typeOfPattern && checker . getPropertyOfType ( typeOfPattern , unescapeLeadingUnderscores ( ( < Identifier > bindingElement . name ) . text ) ) ;
608610 }
@@ -641,7 +643,7 @@ namespace ts.FindAllReferences.Core {
641643
642644 // If symbol is of object binding pattern element without property name we would want to
643645 // look for property too and that could be anywhere
644- if ( isObjectBindingPatternElementWithoutPropertyName ( symbol ) ) {
646+ if ( getObjectBindingElementWithoutPropertyName ( symbol ) ) {
645647 return undefined ;
646648 }
647649
0 commit comments