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

@ -25,7 +25,7 @@ async function createNewColumn(url, columnTitle, projectColorInput) {
}
}
async function moveIssue({item, from, to, oldIndex}) {
async function moveIssue({item, from, to, oldIndex}: {item: HTMLElement, from: HTMLElement, to: HTMLElement, oldIndex: number}) {
const columnCards = to.querySelectorAll('.issue-card');
updateIssueCount(from);
updateIssueCount(to);
@ -97,14 +97,14 @@ export function initRepoProject() {
return;
}
const _promise = initRepoProjectSortable();
initRepoProjectSortable(); // no await
for (const modal of document.querySelectorAll('.edit-project-column-modal')) {
const projectHeader = modal.closest('.project-column-header');
const projectTitleLabel = projectHeader?.querySelector('.project-column-title-label');
const projectTitleInput = modal.querySelector('.project-column-title-input');
const projectColorInput = modal.querySelector('#new_project_column_color');
const boardColumn = modal.closest('.project-column');
const projectHeader = modal.closest<HTMLElement>('.project-column-header');
const projectTitleLabel = projectHeader?.querySelector<HTMLElement>('.project-column-title-label');
const projectTitleInput = modal.querySelector<HTMLInputElement>('.project-column-title-input');
const projectColorInput = modal.querySelector<HTMLInputElement>('#new_project_column_color');
const boardColumn = modal.closest<HTMLElement>('.project-column');
modal.querySelector('.edit-project-column-button')?.addEventListener('click', async function (e) {
e.preventDefault();
try {
@ -119,7 +119,7 @@ export function initRepoProject() {
} finally {
projectTitleLabel.textContent = projectTitleInput?.value;
projectTitleInput.closest('form')?.classList.remove('dirty');
const dividers = boardColumn.querySelectorAll(':scope > .divider');
const dividers = boardColumn.querySelectorAll<HTMLElement>(':scope > .divider');
if (projectColorInput.value) {
const color = contrastColor(projectColorInput.value);
boardColumn.style.setProperty('background', projectColorInput.value, 'important');