From 32002fe6bd87f3d7ccc2fa3ef6e0a29badde2664 Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Thu, 22 Jan 2026 19:44:10 -0500 Subject: [PATCH] Fix: Resolve implicit any and property access errors in core components --- .../ae_comp__hosted_files_clip_video_v1.svelte | 8 ++++---- .../ae_core/ae_comp__hosted_files_upload.svelte | 14 ++++++++------ src/lib/element_qr_scanner_v2.svelte | 4 ++-- src/lib/elements/element_input_files_tbl.svelte | 4 ++-- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/lib/ae_core/ae_comp__hosted_files_clip_video_v1.svelte b/src/lib/ae_core/ae_comp__hosted_files_clip_video_v1.svelte index 3b8f8a71..c14a14b4 100644 --- a/src/lib/ae_core/ae_comp__hosted_files_clip_video_v1.svelte +++ b/src/lib/ae_core/ae_comp__hosted_files_clip_video_v1.svelte @@ -74,11 +74,11 @@ reencode: null, video_file: null }; - let download_clip_src: string = $state(); - let download_clip_filename: string; + let download_clip_src: string = $state(''); + let download_clip_filename: string = $state('clipped_video.mp4'); // *** Functions and Logic - async function handle_submit_form_files(event: SubmitEvent) { + async function handle_submit_form_files(event: Event) { console.log('*** handle_submit_form() ***'); $ae_sess.files.disable_submit__hosted_file_obj = true; @@ -169,7 +169,7 @@ upload_complete = true; } - async function handle_input_upload_files(input_upload_files, form_kv, task_id) { + async function handle_input_upload_files(input_upload_files: File[], form_kv: any, task_id: string) { console.log('*** handle_input_upload_files() ***'); console.log(input_upload_files); console.log(form_kv); diff --git a/src/lib/ae_core/ae_comp__hosted_files_upload.svelte b/src/lib/ae_core/ae_comp__hosted_files_upload.svelte index f1149e39..97abe6af 100644 --- a/src/lib/ae_core/ae_comp__hosted_files_upload.svelte +++ b/src/lib/ae_core/ae_comp__hosted_files_upload.svelte @@ -95,19 +95,21 @@ let hosted_file_results; const target = event.target as HTMLFormElement; + const file_input = target ? (target[input_element_id] as HTMLInputElement) : null; + if ( target && - target[input_element_id] && - (target[input_element_id] as HTMLInputElement)?.files && - (target[input_element_id] as HTMLInputElement).files.length > 0 + file_input && + file_input.files && + file_input.files.length > 0 ) { task_id = link_to_id; // Ideally this should be the file hash, but we may be uploading multiple files at once. This should be done with a loop instead? // Loop through each file and upload them individually in event.target[input_element_id].files // The task_id should be the file hash. // processed_file_list[i] has the file hash_sha256, hash_sha256_match, warnings, uploaded, uploaded_bytes, filename, and file_size_bytes. - for (let i = 0; i < event.target[input_element_id].files.length; i++) { - let tmp_file = event.target[input_element_id].files[i]; + for (let i = 0; i < file_input.files.length; i++) { + let tmp_file = file_input.files[i]; task_id = $ae_sess.files.processed_file_list[i].hash_sha256; @@ -126,7 +128,7 @@ // hosted_file_results = await handle_input_upload_files(event.target[input_element_id].files, task_id); $ae_sess.files.processed_file_list = []; $ae_sess = $ae_sess; // Is this needed? 2025-03-17 - event.target.reset(); + target.reset(); // await tick(); if (log_lvl) { diff --git a/src/lib/element_qr_scanner_v2.svelte b/src/lib/element_qr_scanner_v2.svelte index 5dc603f6..91331e59 100644 --- a/src/lib/element_qr_scanner_v2.svelte +++ b/src/lib/element_qr_scanner_v2.svelte @@ -213,7 +213,7 @@ return true; }) - .catch((err) => { + .catch((err: any) => { console.log('There was an error while trying to start the QR scanner'); scanning_status = 'start_error'; @@ -320,7 +320,7 @@ qr_entered_text = null; } - function send_init_confirm_email(subject, message) { + function send_init_confirm_email(subject: string, message: any) { console.log(`*** send_init_confirm_email() *** ${subject}`); let to_email = 'scott.idem+skdev@oneskyit.com'; diff --git a/src/lib/elements/element_input_files_tbl.svelte b/src/lib/elements/element_input_files_tbl.svelte index cfcf6326..a47e3040 100644 --- a/src/lib/elements/element_input_files_tbl.svelte +++ b/src/lib/elements/element_input_files_tbl.svelte @@ -258,14 +258,14 @@ return processed_file_list; } - function remove_file_from_filelist(index) { + function remove_file_from_filelist(index: number) { console.log('*** remove_file_from_filelist() ***'); // Can not use something like this because it is readonly: const dt = new DataTransfer(); // let input = document.getElementById(input_element_id); - let input_element = document.querySelector('input[type="file"].svelte_input_file_element'); + let input_element = document.querySelector('input[type="file"].svelte_input_file_element') as HTMLInputElement; if (!input_element) { console.error('Could not find the input element.');