Skip to content

Commit 17218e2

Browse files
committed
chore: update TS to 4.8.4
1 parent c4f0d52 commit 17218e2

File tree

4 files changed

+17
-16
lines changed

4 files changed

+17
-16
lines changed

package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"tsify": "^5.0.4",
5353
"tslint": "~6.1.3",
5454
"tslint-eslint-rules": "^5.4.0",
55-
"typescript": "^4.3.2",
55+
"typescript": "^4.8.4",
5656
"whatwg-fetch": "^3.6.2"
5757
},
5858
"dependencies": {

src/ts/file-reader.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export function readFile(file: File,
2121
const harData = JSON.parse(rawData);
2222
callback(null, harData.log);
2323
} catch (e) {
24-
callback(e);
24+
callback(e as Error);
2525
}
2626
}
2727

src/ts/transformers/har.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)