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:
@@ -116,7 +116,7 @@ export async function generate_qr_code({
|
||||
|
||||
// If it's an ArrayBuffer or Uint8Array, convert to Blob
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ export async function generate_qr_code({
|
||||
|
||||
// Fallback: try to create a Blob from whatever is left
|
||||
try {
|
||||
const blob = new Blob([data], { type: 'image/png' });
|
||||
const blob = new Blob([data as BlobPart], { type: 'image/png' });
|
||||
return URL.createObjectURL(blob);
|
||||
} catch (e) {
|
||||
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 {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.
|
||||
* @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 {
|
||||
n = '',
|
||||
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);
|
||||
|
||||
let qr_data = null;
|
||||
let qr_data: string | null = null;
|
||||
|
||||
// --- 1. Replicate Data Formatting Logic ---
|
||||
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
|
||||
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;
|
||||
|
||||
case 'obj':
|
||||
|
||||
Reference in New Issue
Block a user