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:
@@ -175,6 +175,8 @@ const RecipeSchema = new mongoose.Schema(
|
||||
RecipeSchema.index({ "translations.en.short_name": 1 });
|
||||
RecipeSchema.index({ "translations.en.translationStatus": 1 });
|
||||
|
||||
let _recipeModel: any;
|
||||
try { _recipeModel = mongoose.model("Recipe"); } catch { _recipeModel = mongoose.model("Recipe", RecipeSchema); }
|
||||
export const Recipe = _recipeModel as mongoose.Model<any>;
|
||||
import type { RecipeModelType } from '$types/types';
|
||||
|
||||
let _recipeModel: mongoose.Model<RecipeModelType>;
|
||||
try { _recipeModel = mongoose.model<RecipeModelType>("Recipe"); } catch { _recipeModel = mongoose.model<RecipeModelType>("Recipe", RecipeSchema); }
|
||||
export const Recipe = _recipeModel;
|
||||
|
||||
Reference in New Issue
Block a user