fix: resolve all 1008 svelte-check type errors across codebase
Add type annotations, JSDoc types, null checks, and proper generics to eliminate all svelte-check errors. Key changes include: - Type $state(null) variables to avoid 'never' inference - Add JSDoc typedefs for plain <script> components - Fix mongoose model typing with Model<any> to avoid union complexity - Add App.Error/App.PageState interfaces in app.d.ts - Fix tuple types to array types in types.ts - Type catch block errors and API handler params - Add null safety for DOM queries and optional chaining - Add standard line-clamp property alongside -webkit- prefix
This commit is contained in:
@@ -121,7 +121,7 @@ export async function validateImageFile(file: File): Promise<ValidationResult> {
|
||||
console.error('[ImageValidation] Magic bytes validation error:', error);
|
||||
return {
|
||||
valid: false,
|
||||
error: `Failed to validate file headers: ${error.message}`
|
||||
error: `Failed to validate file headers: ${error instanceof Error ? error.message : String(error)}`
|
||||
};
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ export async function validateImageFile(file: File): Promise<ValidationResult> {
|
||||
console.error('[ImageValidation] Sharp validation error:', error);
|
||||
return {
|
||||
valid: false,
|
||||
error: `Invalid or corrupted image file: ${error.message}`
|
||||
error: `Invalid or corrupted image file: ${error instanceof Error ? error.message : String(error)}`
|
||||
};
|
||||
}
|
||||
|
||||
@@ -217,7 +217,7 @@ export async function validateImageBuffer(buffer: Buffer, filename: string): Pro
|
||||
} catch (error) {
|
||||
return {
|
||||
valid: false,
|
||||
error: `Failed to validate buffer headers: ${error.message}`
|
||||
error: `Failed to validate buffer headers: ${error instanceof Error ? error.message : String(error)}`
|
||||
};
|
||||
}
|
||||
|
||||
@@ -241,7 +241,7 @@ export async function validateImageBuffer(buffer: Buffer, filename: string): Pro
|
||||
} catch (error) {
|
||||
return {
|
||||
valid: false,
|
||||
error: `Invalid or corrupted image buffer: ${error.message}`
|
||||
error: `Invalid or corrupted image buffer: ${error instanceof Error ? error.message : String(error)}`
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ export interface RecipeFormData {
|
||||
mediapath: string;
|
||||
alt: string;
|
||||
caption: string;
|
||||
color?: string;
|
||||
}>;
|
||||
|
||||
// Cake form
|
||||
|
||||
@@ -459,8 +459,8 @@ class DeepLTranslationService {
|
||||
const changed: string[] = [];
|
||||
|
||||
for (const field of fieldsToCheck) {
|
||||
const oldValue = JSON.stringify(oldRecipe[field] || '');
|
||||
const newValue = JSON.stringify(newRecipe[field] || '');
|
||||
const oldValue = JSON.stringify((oldRecipe as any)[field] || '');
|
||||
const newValue = JSON.stringify((newRecipe as any)[field] || '');
|
||||
if (oldValue !== newValue) {
|
||||
changed.push(field);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user