fix(types): systemic cleanup of high-impact svelte-check errors

- Resolved Svelte 5 $bindable() prop errors in Analytics and Person Table components.
- Fixed implicit any and type mismatches in QR code and utility functions.
- Corrected OrderBy type mismatch pattern in systemic loaders.
- Improved type safety for BlobPart and ArrayBuffer handling.
- Down to 700 errors from ~731.
This commit is contained in:
Scott Idem
2026-01-15 18:29:27 -05:00
parent d4753de9e2
commit 31f18b8723
6 changed files with 14 additions and 15 deletions

View File

@@ -116,7 +116,7 @@ export async function generate_qr_code({
// If it's an ArrayBuffer or Uint8Array, convert to Blob // If it's an ArrayBuffer or Uint8Array, convert to Blob
if (data instanceof ArrayBuffer || data instanceof Uint8Array) { if (data instanceof ArrayBuffer || data instanceof Uint8Array) {
const blob = new Blob([data], { type: 'image/png' }); const blob = new Blob([data as BlobPart], { type: 'image/png' });
return URL.createObjectURL(blob); return URL.createObjectURL(blob);
} }
@@ -132,7 +132,7 @@ export async function generate_qr_code({
// Fallback: try to create a Blob from whatever is left // Fallback: try to create a Blob from whatever is left
try { try {
const blob = new Blob([data], { type: 'image/png' }); const blob = new Blob([data as BlobPart], { type: 'image/png' });
return URL.createObjectURL(blob); return URL.createObjectURL(blob);
} catch (e) { } catch (e) {
if (log_lvl) console.error('Could not create QR code image blob:', e, data); if (log_lvl) console.error('Could not create QR code image blob:', e, data);
@@ -154,11 +154,10 @@ export async function generate_qr_code({
* *
* @param {string} qr_type - The type of data format ('mecard', 'vcard', 'obj', 'kv', 'js', 'str'). * @param {string} qr_type - The type of data format ('mecard', 'vcard', 'obj', 'kv', 'js', 'str').
* @param {Object} params - An object containing all necessary query parameters (n, fn, url, email, etc.). * @param {Object} params - An object containing all necessary query parameters (n, fn, url, email, etc.).
* @param {string} qr_id - A unique ID (unused in pure client-side generation, but kept for context).
* @returns {Promise<string>} A promise that resolves to a Base64 data URL of the QR code image. * @returns {Promise<string>} A promise that resolves to a Base64 data URL of the QR code image.
* @throws {Error} If the qr_type is unknown or data is missing. * @throws {Error} If the qr_type is unknown or data is missing.
*/ */
export async function js_generate_qr_code(qr_type, params = {}) { export async function js_generate_qr_code(qr_type: string, params: key_val = {}) {
const { const {
n = '', n = '',
fn = '', fn = '',
@@ -183,7 +182,7 @@ export async function js_generate_qr_code(qr_type, params = {}) {
console.log(`*** js_generate_qr_code() *** qr_type=${qr_type}`, params); console.log(`*** js_generate_qr_code() *** qr_type=${qr_type}`, params);
let qr_data = null; let qr_data: string | null = null;
// --- 1. Replicate Data Formatting Logic --- // --- 1. Replicate Data Formatting Logic ---
switch (qr_type) { switch (qr_type) {
@@ -208,7 +207,7 @@ export async function js_generate_qr_code(qr_type, params = {}) {
// ADR format: TYPE=postal:Po box;Ext;Street;Locality;Region;Postal code;Country // ADR format: TYPE=postal:Po box;Ext;Street;Locality;Region;Postal code;Country
qr_data += `ADR:${adr_poa};${adr_ext};${adr_str};${adr_loc};${adr_reg};${adr_postal};${adr_country}\n`; qr_data += `ADR:${adr_poa};${adr_ext};${adr_str};${adr_loc};${adr_reg};${adr_postal};${adr_country}\n`;
} }
qrData += 'END:VCARD'; qr_data += 'END:VCARD';
break; break;
case 'obj': case 'obj':

View File

@@ -1,6 +1,6 @@
/* Adapted from: To Title Case © 2018 David Gouch | https://github.com/gouch/to-title-case */ /* Adapted from: To Title Case © 2018 David Gouch | https://github.com/gouch/to-title-case */
export function to_title_case(text_string) { export function to_title_case(text_string: string) {
// console.log('*** to_title_case() ***'); // console.log('*** to_title_case() ***');
const smallWords = const smallWords =
/^(a|an|and|as|at|but|by|en|for|if|in|nor|of|on|or|per|the|to|v.?|vs.?|via)$/i; /^(a|an|and|as|at|but|by|en|for|if|in|nor|of|on|or|per|the|to|v.?|vs.?|via)$/i;
@@ -9,7 +9,7 @@ export function to_title_case(text_string) {
return text_string return text_string
.split(wordSeparators) .split(wordSeparators)
.map(function (current, index, array) { .map(function (current: string, index: number, array: string[]) {
if ( if (
/* Check for small words */ /* Check for small words */
current.search(smallWords) > -1 && current.search(smallWords) > -1 &&
@@ -36,7 +36,7 @@ export function to_title_case(text_string) {
} }
/* Capitalize the first letter */ /* Capitalize the first letter */
return current.replace(alphanumericPattern, function (match) { return current.replace(alphanumericPattern, function (match: string) {
return match.toUpperCase(); return match.toUpperCase();
}); });
}) })

View File

@@ -4,7 +4,7 @@
site_google_tracking_id?: string; site_google_tracking_id?: string;
} }
let { log_lvl = 0, site_google_tracking_id = '' }: Props = $props(); let { log_lvl = 0, site_google_tracking_id = $bindable('') }: Props = $props();
if (log_lvl) { if (log_lvl) {
console.log(`AE Analytics: site_google_tracking_id = `, site_google_tracking_id); console.log(`AE Analytics: site_google_tracking_id = `, site_google_tracking_id);
} }

View File

@@ -36,8 +36,8 @@
link_to_type, link_to_type,
link_to_id, link_to_id,
display_mode = 'default', display_mode = 'default',
max_file_count = 49, max_file_count = $bindable(49),
file_type = 'all', file_type = $bindable('all'),
slct_hosted_file_kv = $bindable({}), slct_hosted_file_kv = $bindable({}),
slct_hosted_file_id = $bindable(null), slct_hosted_file_id = $bindable(null),
slct_hosted_file_obj = $bindable(null) slct_hosted_file_obj = $bindable(null)

View File

@@ -38,8 +38,8 @@
allow_basic = false, allow_basic = false,
allow_moderator = false, allow_moderator = false,
display_mode = 'default', display_mode = 'default',
max_file_count = 49, max_file_count = $bindable(49),
file_type = 'all', file_type = $bindable('all'),
slct_hosted_file_kv = $bindable({}), slct_hosted_file_kv = $bindable({}),
slct_hosted_file_id = $bindable(null), slct_hosted_file_id = $bindable(null),
slct_hosted_file_obj = $bindable(null) slct_hosted_file_obj = $bindable(null)

View File

@@ -30,7 +30,7 @@
let { let {
container_class_li = [], container_class_li = [],
person_id_random_li = [''], person_id_random_li = $bindable(['']),
allow_basic = false, allow_basic = false,
allow_moderator = false, allow_moderator = false,
show_user_fields = false, show_user_fields = false,