@@ -281,12 +281,19 @@ export function processDeclarations(
281281 const typeMatches = importText . match ( / t y p e \s + ( [ A - Z a - z _ $ ] [ \w $ ] * ) / g)
282282 const valueMatches = importText . match ( / i m p o r t \s + \{ ( [ ^ } ] + ) \} / )
283283
284+ // Get all text to check (both variable.text and variable.typeAnnotation)
285+ const textToCheck = [ variable . text ]
286+ if ( variable . typeAnnotation ) {
287+ textToCheck . push ( variable . typeAnnotation )
288+ }
289+
284290 // Check type imports
285291 if ( typeMatches ) {
286292 for ( const typeMatch of typeMatches ) {
287293 const typeName = typeMatch . replace ( 'type ' , '' ) . trim ( )
288294 const regex = new RegExp ( `\\b${ typeName . replace ( / [ . * + ? ^ $ { } ( ) | [ \] \\ ] / g, '\\$&' ) } \\b` )
289- if ( regex . test ( variable . text ) ) {
295+ // Check both variable.text and variable.typeAnnotation
296+ if ( textToCheck . some ( text => regex . test ( text ) ) ) {
290297 usedImportItems . add ( typeName )
291298 }
292299 }
@@ -299,11 +306,22 @@ export function processDeclarations(
299306 )
300307 for ( const importName of imports ) {
301308 const regex = new RegExp ( `\\b${ importName . replace ( / [ . * + ? ^ $ { } ( ) | [ \] \\ ] / g, '\\$&' ) } \\b` )
302- if ( regex . test ( variable . text ) ) {
309+ // Check both variable.text and variable.typeAnnotation
310+ if ( textToCheck . some ( text => regex . test ( text ) ) ) {
303311 usedImportItems . add ( importName )
304312 }
305313 }
306314 }
315+
316+ // Also check using the more comprehensive extractAllImportedItems function
317+ const allImportedItems = extractAllImportedItems ( imp . text )
318+ for ( const item of allImportedItems ) {
319+ const regex = new RegExp ( `\\b${ item . replace ( / [ . * + ? ^ $ { } ( ) | [ \] \\ ] / g, '\\$&' ) } \\b` )
320+ // Check both variable.text and variable.typeAnnotation
321+ if ( textToCheck . some ( text => regex . test ( text ) ) ) {
322+ usedImportItems . add ( item )
323+ }
324+ }
307325 }
308326 }
309327 }
0 commit comments