mirror of
https://github.com/pezkuwichain/pezkuwi-telemetry.git
synced 2026-06-13 19:41:02 +00:00
frontend: Upgrade TypeScript from 2.9.2 to 4.4.2 (#387)
* Upgrade TS from 2.9.2 to 4.4.2 * Avoid mutating a readonly array `list` is a readonly array but `sort` will mutate the array in-place. In newer version of TS, it can catch this unexpected behavior. To avoid mutating a readonly array, we can sort with a new array with either `[...list]` or `list.slice()`. * Fix arguments of `window.location.reload` The `reload` function type definition in `lib.dom.d.ts` takes 0 arguments now. So, we cannot pass a boolean to it. Also, based on the documentation on MDN, Firefox is the only browser who supports passing a `forceForget` boolean to `reload` function. So, I wonder it should be fine to remove the boolean argument and align the behavior to other browsers. Ref: https://developer.mozilla.org/en-US/docs/Web/API/Location/reload
This commit is contained in:
@@ -487,7 +487,7 @@ export class Connection {
|
||||
this.clean();
|
||||
|
||||
// Force reload from the server
|
||||
setTimeout(() => window.location.reload(true), 3000);
|
||||
setTimeout(() => window.location.reload(), 3000);
|
||||
}
|
||||
|
||||
private clean() {
|
||||
|
||||
@@ -119,7 +119,9 @@ export class NumStats<T extends number> {
|
||||
|
||||
let sum = 0;
|
||||
|
||||
for (const n of list.sort((a, b) => a - b).slice(extremes, -extremes)) {
|
||||
for (const n of [...list]
|
||||
.sort((a, b) => a - b)
|
||||
.slice(extremes, -extremes)) {
|
||||
sum += n;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user