Skip to content

Commit

Permalink
chore: update TS to 4.8.4
Browse files Browse the repository at this point in the history
  • Loading branch information
micmro committed Nov 12, 2022
1 parent c4f0d52 commit 17218e2
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 16 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"tsify": "^5.0.4",
"tslint": "~6.1.3",
"tslint-eslint-rules": "^5.4.0",
"typescript": "^4.3.2",
"typescript": "^4.8.4",
"whatwg-fetch": "^3.6.2"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion src/ts/file-reader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function readFile(file: File,
const harData = JSON.parse(rawData);
callback(null, harData.log);
} catch (e) {
callback(e);
callback(e as Error);
}
}

Expand Down
15 changes: 8 additions & 7 deletions src/ts/transformers/har.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ const getUserTimings = (currPage: Page, options: ChartOptions) => {
name = escapeHtml(name);

if (fullName !== name && currPage[`_userTime.endTimer-${name}`]) {
duration = currPage[`_userTime.endTimer-${name}`] - currPage[k];
duration = currPage[`_userTime.endTimer-${name}`] as number - currPage[k];
return {
duration,
name: `${options.showUserTimingEndMarker ? fullName : name} (${currPage[k]} - ${currPage[k] + duration} ms)`,
Expand Down Expand Up @@ -279,18 +279,19 @@ const buildDetailTimingBlocks = (startRelative: number, harEntry: Entry): Waterf
* @param {number} startRelative - Number of milliseconds since page load started (`page.startedDateTime`)
* @returns {Object}
*/
const getTimePair = (key: string, harEntry: Entry, collect: WaterfallEntryTiming[], startRelative: number) => {
let wptKey;
const getTimePair = (key: TimingType, harEntry: Entry, collect: WaterfallEntryTiming[], startRelative: number) => {
let wptKey: Exclude<TimingType, 'wait' | 'receive'> | 'ttfb' | 'download';

switch (key) {
case "wait": wptKey = "ttfb"; break;
case "receive": wptKey = "download"; break;
default: wptKey = key;
}
const preciseStart = parseInt(harEntry[`_${wptKey}_start`], 10);
const preciseEnd = parseInt(harEntry[`_${wptKey}_end`], 10);
const preciseStart = parseInt(`${harEntry[`_${wptKey}_start`]}`, 10);
const preciseEnd = parseInt(`${harEntry[`_${wptKey}_end`]}`, 10);
const start = isNaN(preciseStart) ?
((collect.length > 0) ? collect[collect.length - 1].end : startRelative) : preciseStart;
const end = isNaN(preciseEnd) ? (start + harEntry.timings[key]) : preciseEnd;
((collect.length > 0) ? collect[collect.length - 1].end : startRelative) : preciseStart;
const end = isNaN(preciseEnd) ? (start + (harEntry.timings[key] ?? 0)) : preciseEnd;

return {
end: Math.round(end),
Expand Down

0 comments on commit 17218e2

Please sign in to comment.