@@ -498,17 +498,26 @@ function getOuterBindingIdentifiers(
498498
499499export { getOuterBindingIdentifiers } ;
500500
501+ function getBindingIdentifierPaths (
502+ duplicates : true ,
503+ outerOnly ?: boolean ,
504+ ) : Record < string , NodePath < t . Identifier > [ ] > ;
505+ function getBindingIdentifierPaths (
506+ duplicates : false ,
507+ outerOnly ?: boolean ,
508+ ) : Record < string , NodePath < t . Identifier > > ;
509+ function getBindingIdentifierPaths (
510+ duplicates ?: boolean ,
511+ outerOnly ?: boolean ,
512+ ) : Record < string , NodePath < t . Identifier > | NodePath < t . Identifier > [ ] > ;
513+
501514// original source - https://github.com/babel/babel/blob/main/packages/babel-types/src/retrievers/getBindingIdentifiers.js
502- // path.getBindingIdentifiers returns nodes where the following re-implementation
503- // returns paths
504- export function getBindingIdentifierPaths (
515+ // path.getBindingIdentifiers returns nodes where the following re-implementation returns paths
516+ function getBindingIdentifierPaths (
505517 this : NodePath ,
506518 duplicates : boolean = false ,
507519 outerOnly : boolean = false ,
508- ) : {
509- // todo: returns NodePath<t.Identifier>[] when duplicates is true
510- [ x : string ] : NodePath < t . Identifier > ;
511- } {
520+ ) : Record < string , NodePath < t . Identifier > | NodePath < t . Identifier > [ ] > {
512521 const path = this ;
513522 const search = [ path ] ;
514523 const ids = Object . create ( null ) ;
@@ -563,13 +572,26 @@ export function getBindingIdentifierPaths(
563572 }
564573 }
565574
566- // $FlowIssue Object.create() is object type
567575 return ids ;
568576}
569577
570- export function getOuterBindingIdentifierPaths (
571- this : NodePath ,
578+ export { getBindingIdentifierPaths } ;
579+
580+ function getOuterBindingIdentifierPaths (
581+ duplicates : true ,
582+ ) : Record < string , NodePath < t . Identifier > [ ] > ;
583+ function getOuterBindingIdentifierPaths (
584+ duplicates ?: false ,
585+ ) : Record < string , NodePath < t . Identifier > > ;
586+ function getOuterBindingIdentifierPaths (
572587 duplicates ?: boolean ,
588+ ) : Record < string , NodePath < t . Identifier > | NodePath < t . Identifier > [ ] > ;
589+
590+ function getOuterBindingIdentifierPaths (
591+ this : NodePath ,
592+ duplicates : boolean = false ,
573593) {
574594 return this . getBindingIdentifierPaths ( duplicates , true ) ;
575595}
596+
597+ export { getOuterBindingIdentifierPaths } ;
0 commit comments