Fix a number of typescript errors (#32773)

Fixes 96 typescript errors. Behaviour changes are commented below.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
silverwind 2024-12-11 09:29:04 +01:00 committed by GitHub
parent e619384098
commit 8a53a39c42
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 81 additions and 80 deletions

View file

@ -22,7 +22,7 @@ export function initRepoGraphGit() {
for (const link of document.querySelectorAll('.pagination a')) {
const href = link.getAttribute('href');
if (!href) continue;
const url = new URL(href, window.location);
const url = new URL(href, window.location.href);
const params = url.searchParams;
params.set('mode', 'monochrome');
url.search = `?${params.toString()}`;
@ -38,7 +38,7 @@ export function initRepoGraphGit() {
for (const link of document.querySelectorAll('.pagination a')) {
const href = link.getAttribute('href');
if (!href) continue;
const url = new URL(href, window.location);
const url = new URL(href, window.location.href);
const params = url.searchParams;
params.delete('mode');
url.search = `?${params.toString()}`;
@ -53,7 +53,7 @@ export function initRepoGraphGit() {
window.history.replaceState({}, '', window.location.pathname);
}
});
const url = new URL(window.location);
const url = new URL(window.location.href);
const params = url.searchParams;
const updateGraph = () => {
const queryString = params.toString();
@ -103,7 +103,7 @@ export function initRepoGraphGit() {
},
onAdd(toAdd) {
if (toAdd === '...flow-hide-pr-refs') {
params.set('hide-pr-refs', true);
params.set('hide-pr-refs', 'true');
} else {
params.append('branch', toAdd);
}
@ -111,7 +111,7 @@ export function initRepoGraphGit() {
},
});
graphContainer.addEventListener('mouseenter', (e) => {
graphContainer.addEventListener('mouseenter', (e: MouseEvent & {target: HTMLElement}) => {
if (e.target.matches('#rev-list li')) {
const flow = e.target.getAttribute('data-flow');
if (flow === '0') return;
@ -132,7 +132,7 @@ export function initRepoGraphGit() {
}
});
graphContainer.addEventListener('mouseleave', (e) => {
graphContainer.addEventListener('mouseleave', (e: MouseEvent & {target: HTMLElement}) => {
if (e.target.matches('#rev-list li')) {
const flow = e.target.getAttribute('data-flow');
if (flow === '0') return;