@@ -446,24 +446,25 @@ export class IssueModel<TItem extends Issue = Issue> extends Disposable {
446446 const times = [
447447 time ,
448448 new Date ( data . repository . pullRequest . updatedAt ) ,
449- ...( data . repository . pullRequest . reactions . nodes . map ( node => new Date ( node . createdAt ) ) ) ,
449+ ...( data . repository . pullRequest . reactions . nodes . filter ( ( node ) : node is { createdAt : string } => ! ! node ) . map ( node => new Date ( node . createdAt ) ) ) ,
450450 ...( data . repository . pullRequest . comments . nodes . map ( node => new Date ( node . updatedAt ) ) ) ,
451- ...( data . repository . pullRequest . comments . nodes . flatMap ( node => node . reactions . nodes . map ( reaction => new Date ( reaction . createdAt ) ) ) ) ,
451+ ...( data . repository . pullRequest . comments . nodes . flatMap ( node => node . reactions . nodes . filter ( ( reaction ) : reaction is { createdAt : string } => ! ! reaction ) . map ( reaction => new Date ( reaction . createdAt ) ) ) ) ,
452452 ...( data . repository . pullRequest . timelineItems . nodes . map ( node => {
453453 const latestCommit = node as ( Partial < LatestCommit > | null ) ;
454454 if ( latestCommit ?. commit ?. committedDate ) {
455455 return new Date ( latestCommit . commit . committedDate ) ;
456456 }
457457 const latestReviewThread = node as ( Partial < LatestReviewThread > | null ) ;
458- if ( ( latestReviewThread ?. comments ?. nodes . length ?? 0 ) > 0 ) {
458+ if ( ( ( latestReviewThread ?. comments ?. nodes . length ?? 0 ) > 0 ) && latestReviewThread ! . comments ! . nodes [ 0 ] ) {
459459 return new Date ( latestReviewThread ! . comments ! . nodes [ 0 ] . createdAt ) ;
460+ } else if ( node ) {
461+ return new Date ( ( node as { createdAt : string } ) . createdAt ) ;
460462 }
461- return new Date ( ( node as { createdAt : string } ) . createdAt ) ;
462463 } ) )
463464 ] ;
464465
465466 // Sort times and return the most recent one
466- return new Date ( Math . max ( ...times . map ( t => t . getTime ( ) ) ) ) ;
467+ return new Date ( Math . max ( ...times . filter ( ( t ) : t is Date => ! ! t ) . map ( t => t . getTime ( ) ) ) ) ;
467468 } catch ( e ) {
468469 Logger . error ( `Error fetching timeline events of issue #${ this . number } - ${ formatError ( e ) } ` , IssueModel . ID ) ;
469470 return time ; // Return the original time in case of an error
0 commit comments