@@ -141,16 +141,16 @@ export default function transform(file: FileInfo, api: API): string | undefined
141141 packageNames . forEach ( ( pkg ) => {
142142 root . find ( j . ImportDeclaration , { source : { value : pkg } } ) . forEach ( ( importPath ) => {
143143 const specifiers = importPath . node . specifiers || [ ] ;
144- specifiers . forEach ( ( spec ) => {
144+ specifiers . forEach ( ( spec : any ) => {
145145 if ( spec . type !== 'ImportSpecifier' ) return ;
146146 const importedName = spec . imported . name as string ;
147147 let componentName = importedName ;
148148 if ( importedName . endsWith ( 'PropTypes' ) ) {
149149 componentName = importedName . replace ( / P r o p T y p e s $ / , '' ) ;
150150 } else if ( importedName . endsWith ( 'Props' ) ) {
151- componentName = importedName . replace ( / P r o p s $ / , '' ) ;
151+ componentName = componentName . replace ( / P r o p s $ / , '' ) ;
152152 } else if ( importedName . endsWith ( 'DomRef' ) ) {
153- componentName = importedName . replace ( / D o m R e f $ / , '' ) ;
153+ componentName = componentName . replace ( / D o m R e f $ / , '' ) ;
154154 }
155155
156156 let newSource : string ;
@@ -178,7 +178,9 @@ export default function transform(file: FileInfo, api: API): string | undefined
178178 ] ,
179179 j . literal ( newSource ) ,
180180 ) ;
181- newImport . importKind = importPath . node . importKind ;
181+ if ( 'importKind' in spec && spec . importKind === 'type' ) {
182+ newImport . importKind = 'type' ;
183+ }
182184 j ( importPath ) . insertBefore ( newImport ) ;
183185 isDirty = true ;
184186 } ) ;
0 commit comments