fix: replace any types with proper types across codebase
Replace ~100 `any` usages with proper types: use existing interfaces (RecipeModelType, BriefRecipeType, IPayment, etc.), Record<string, unknown> for dynamic objects, unknown for catch clauses with proper narrowing, and inline types for callbacks. Remaining `any` types are in Svelte components and cases where mongoose document mutation requires casts.
This commit is contained in:
@@ -219,8 +219,8 @@ export const actions: Actions = {
|
||||
// Success - redirect to dashboard
|
||||
throw redirect(303, '/cospend');
|
||||
|
||||
} catch (error: any) {
|
||||
if (error.status === 303) throw error; // Re-throw redirect
|
||||
} catch (error: unknown) {
|
||||
if (error && typeof error === 'object' && 'status' in error && (error as { status: number }).status === 303) throw error; // Re-throw redirect
|
||||
|
||||
console.error('Error creating payment:', error);
|
||||
return fail(500, {
|
||||
|
||||
@@ -114,13 +114,14 @@ export const actions: Actions = {
|
||||
|
||||
// Redirect back to dashboard on success
|
||||
throw redirect(303, '/cospend');
|
||||
} catch (error: any) {
|
||||
if (error.status === 303) {
|
||||
} catch (error: unknown) {
|
||||
if (error && typeof error === 'object' && 'status' in error && (error as { status: number }).status === 303) {
|
||||
throw error; // Re-throw redirect
|
||||
}
|
||||
|
||||
const message = error instanceof Error ? error.message : String(error);
|
||||
return fail(500, {
|
||||
error: error.message,
|
||||
error: message,
|
||||
values: {
|
||||
settlementType,
|
||||
fromUser,
|
||||
|
||||
Reference in New Issue
Block a user