@@ -411,10 +411,10 @@ export function getLogItems(dir: string, parseTitle: (filePath: string) => strin
411411}
412412
413413// 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 } > ( ) ;
415415
416416// Helper function for reading and parsing JSON reports with caching
417- function getReportContent ( filePath : string ) : any | null {
417+ function getReportContent ( filePath : string ) : unknown | null {
418418 try {
419419 const stats = fs . statSync ( filePath ) ;
420420 const cachedReport = reportCache . get ( filePath ) ;
@@ -447,10 +447,18 @@ export function parseReportTitle(filePath: string): string {
447447 if ( filePath . includes ( '/api/' ) ) {
448448 const folderName = path . basename ( path . dirname ( filePath ) ) ;
449449 const capitalizedFolderName = folderName . charAt ( 0 ) . toUpperCase ( ) + folderName . slice ( 1 ) ;
450- return `${ capitalizedFolderName } : ${ report } ` ;
450+ return `${ capitalizedFolderName } : ${ String ( report ) } ` ;
451451 }
452452
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 ) ;
454462 } catch ( error ) {
455463 return path . basename ( filePath ) ;
456464 }
@@ -467,8 +475,13 @@ export function getIconForReport(filePath: string): vscode.ThemeIcon {
467475 return new vscode . ThemeIcon ( 'warning' ) ;
468476 }
469477
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+ }
472485 }
473486
474487 return new vscode . ThemeIcon ( 'file' ) ;
0 commit comments