@@ -411,10 +411,10 @@ export function getLogItems(dir: string, parseTitle: (filePath: string) => strin
411
411
}
412
412
413
413
// Cache for JSON reports to avoid repeated parsing
414
- const reportCache = new Map < string , { content : any , timestamp : number } > ( ) ;
414
+ const reportCache = new Map < string , { content : unknown , timestamp : number } > ( ) ;
415
415
416
416
// Helper function for reading and parsing JSON reports with caching
417
- function getReportContent ( filePath : string ) : any | null {
417
+ function getReportContent ( filePath : string ) : unknown | null {
418
418
try {
419
419
const stats = fs . statSync ( filePath ) ;
420
420
const cachedReport = reportCache . get ( filePath ) ;
@@ -447,10 +447,18 @@ export function parseReportTitle(filePath: string): string {
447
447
if ( filePath . includes ( '/api/' ) ) {
448
448
const folderName = path . basename ( path . dirname ( filePath ) ) ;
449
449
const capitalizedFolderName = folderName . charAt ( 0 ) . toUpperCase ( ) + folderName . slice ( 1 ) ;
450
- return `${ capitalizedFolderName } : ${ report } ` ;
450
+ return `${ capitalizedFolderName } : ${ String ( report ) } ` ;
451
451
}
452
452
453
- return report [ '0' ] || path . basename ( filePath ) ;
453
+ // Type guard to check if report is a record type with string keys
454
+ if ( report && typeof report === 'object' && report !== null ) {
455
+ const reportObj = report as Record < string , unknown > ;
456
+ if ( '0' in reportObj && typeof reportObj [ '0' ] === 'string' ) {
457
+ return reportObj [ '0' ] || path . basename ( filePath ) ;
458
+ }
459
+ }
460
+
461
+ return path . basename ( filePath ) ;
454
462
} catch ( error ) {
455
463
return path . basename ( filePath ) ;
456
464
}
@@ -467,8 +475,13 @@ export function getIconForReport(filePath: string): vscode.ThemeIcon {
467
475
return new vscode . ThemeIcon ( 'warning' ) ;
468
476
}
469
477
470
- if ( report [ '0' ] && report [ '0' ] . toLowerCase ( ) . includes ( 'error' ) ) {
471
- return new vscode . ThemeIcon ( 'error' ) ;
478
+ // Type guard to check if report is a record type with string keys
479
+ if ( report && typeof report === 'object' && report !== null ) {
480
+ const reportObj = report as Record < string , unknown > ;
481
+ if ( '0' in reportObj && typeof reportObj [ '0' ] === 'string' &&
482
+ reportObj [ '0' ] . toLowerCase ( ) . includes ( 'error' ) ) {
483
+ return new vscode . ThemeIcon ( 'error' ) ;
484
+ }
472
485
}
473
486
474
487
return new vscode . ThemeIcon ( 'file' ) ;
0 commit comments