import { API , FileInfo , Options } from 'jscodeshift' ; export const getExportNamedDeclaration = ( file , api , options ) => { const j = api . jscodeshift ; const root = j ( file . source ) ; let exports = [ ] ; const declarationTypes = [ 'TypeAlias' , 'TSTypeAliasDeclaration' , 'InterfaceDeclaration' , 'TSEnumDeclaration' , 'TSInterfaceDeclaration' , 'FunctionDeclaration' , ] ; root . find ( j . ExportNamedDeclaration ) . forEach ( ( path ) => { if ( declarationTypes . includes ( path . node . declaration . type ) ) { exports = [ ... exports , path . node . declaration . id . name ] ; } if ( path . node . declaration . type === 'VariableDeclaration' ) { for ( const declaration of path . node . declaration . declarations ) { if ( declaration . type === 'VariableDeclarator' ) { exports = [ ... exports , declaration . id . name ] ; } } } } ) ; return exports ; } ; export default getExportNamedDeclaration ; export const parser = 'tsx' ;