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:
cybai
2021-08-28 00:33:42 +09:00
committed by GitHub
parent 87866b2d42
commit d477cb8045
4 changed files with 9 additions and 7 deletions
+1 -1
View File
@@ -44,7 +44,7 @@
"tslint": "^6.1.1",
"tslint-config-prettier": "^1.18.0",
"tslint-plugin-prettier": "^2.3.0",
"typescript": "^2.9.2"
"typescript": "^4.4.2"
},
"lint-staged": {
"src/**/*.{ts,tsx,json,css}": [