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

@ -1,11 +1,11 @@
import {hideElem, showElem} from '../utils/dom.ts';
export function initRepoRelease() {
document.addEventListener('click', (e) => {
document.addEventListener('click', (e: MouseEvent & {target: HTMLElement}) => {
if (e.target.matches('.remove-rel-attach')) {
const uuid = e.target.getAttribute('data-uuid');
const id = e.target.getAttribute('data-id');
document.querySelector(`input[name='attachment-del-${uuid}']`).value = 'true';
document.querySelector<HTMLInputElement>(`input[name='attachment-del-${uuid}']`).value = 'true';
hideElem(`#attachment-${id}`);
}
});
@ -28,8 +28,8 @@ function initTagNameEditor() {
const newTagHelperText = el.getAttribute('data-tag-helper-new');
const existingTagHelperText = el.getAttribute('data-tag-helper-existing');
const tagNameInput = document.querySelector('#tag-name');
const hideTargetInput = function(tagNameInput) {
const tagNameInput = document.querySelector<HTMLInputElement>('#tag-name');
const hideTargetInput = function(tagNameInput: HTMLInputElement) {
const value = tagNameInput.value;
const tagHelper = document.querySelector('#tag-helper');
if (existingTags.includes(value)) {
@ -42,7 +42,7 @@ function initTagNameEditor() {
}
};
hideTargetInput(tagNameInput); // update on page load because the input may have a value
tagNameInput.addEventListener('input', (e) => {
tagNameInput.addEventListener('input', (e: InputEvent & {target: HTMLInputElement}) => {
hideTargetInput(e.target);
});
}