@@ -214,7 +214,7 @@ const getUserTimings = (currPage: Page, options: ChartOptions) => {
214214 name = escapeHtml ( name ) ;
215215
216216 if ( fullName !== name && currPage [ `_userTime.endTimer-${ name } ` ] ) {
217- duration = currPage [ `_userTime.endTimer-${ name } ` ] - currPage [ k ] ;
217+ duration = currPage [ `_userTime.endTimer-${ name } ` ] as number - currPage [ k ] ;
218218 return {
219219 duration,
220220 name : `${ options . showUserTimingEndMarker ? fullName : name } (${ currPage [ k ] } - ${ currPage [ k ] + duration } ms)` ,
@@ -279,18 +279,19 @@ const buildDetailTimingBlocks = (startRelative: number, harEntry: Entry): Waterf
279279 * @param {number } startRelative - Number of milliseconds since page load started (`page.startedDateTime`)
280280 * @returns {Object }
281281 */
282- const getTimePair = ( key : string , harEntry : Entry , collect : WaterfallEntryTiming [ ] , startRelative : number ) => {
283- let wptKey ;
282+ const getTimePair = ( key : TimingType , harEntry : Entry , collect : WaterfallEntryTiming [ ] , startRelative : number ) => {
283+ let wptKey : Exclude < TimingType , 'wait' | 'receive' > | 'ttfb' | 'download' ;
284+
284285 switch ( key ) {
285286 case "wait" : wptKey = "ttfb" ; break ;
286287 case "receive" : wptKey = "download" ; break ;
287288 default : wptKey = key ;
288289 }
289- const preciseStart = parseInt ( harEntry [ `_${ wptKey } _start` ] , 10 ) ;
290- const preciseEnd = parseInt ( harEntry [ `_${ wptKey } _end` ] , 10 ) ;
290+ const preciseStart = parseInt ( ` ${ harEntry [ `_${ wptKey } _start` ] } ` , 10 ) ;
291+ const preciseEnd = parseInt ( ` ${ harEntry [ `_${ wptKey } _end` ] } ` , 10 ) ;
291292 const start = isNaN ( preciseStart ) ?
292- ( ( collect . length > 0 ) ? collect [ collect . length - 1 ] . end : startRelative ) : preciseStart ;
293- const end = isNaN ( preciseEnd ) ? ( start + harEntry . timings [ key ] ) : preciseEnd ;
293+ ( ( collect . length > 0 ) ? collect [ collect . length - 1 ] . end : startRelative ) : preciseStart ;
294+ const end = isNaN ( preciseEnd ) ? ( start + ( harEntry . timings [ key ] ?? 0 ) ) : preciseEnd ;
294295
295296 return {
296297 end : Math . round ( end ) ,
0 commit comments