From 0e18f382c8da55ec53c12fd4ca0202eab97342c6 Mon Sep 17 00:00:00 2001 From: Nils-Johan Gynther Date: Sun, 12 Apr 2026 09:41:35 +0200 Subject: [PATCH] fix: Add type annotations for better type safety in recipe parsers --- backend/src/quick-import/parsers/generic.parser.ts | 6 +++--- backend/src/quick-import/parsers/ica.parser.ts | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/backend/src/quick-import/parsers/generic.parser.ts b/backend/src/quick-import/parsers/generic.parser.ts index bc359e4b..f83c2bc7 100644 --- a/backend/src/quick-import/parsers/generic.parser.ts +++ b/backend/src/quick-import/parsers/generic.parser.ts @@ -25,7 +25,7 @@ export class GenericRecipeParser extends RecipeParser { const recipe = jsonData['@type'] === 'Recipe' ? jsonData - : jsonData['@graph']?.find((item) => item['@type'] === 'Recipe'); + : jsonData['@graph']?.find((item: any) => item['@type'] === 'Recipe'); if (recipe) { console.log('[GenericParser] ✓ JSON-LD data found'); @@ -59,12 +59,12 @@ export class GenericRecipeParser extends RecipeParser { instructions = recipe.recipeInstructions; } else if (Array.isArray(recipe.recipeInstructions)) { instructions = recipe.recipeInstructions - .map((step) => { + .map((step: any) => { if (typeof step === 'string') return step; if (step.text) return step.text; return ''; }) - .filter((s) => s) + .filter((s: string) => s) .join('\n\n'); } } diff --git a/backend/src/quick-import/parsers/ica.parser.ts b/backend/src/quick-import/parsers/ica.parser.ts index 3f10a610..dcaf58e3 100644 --- a/backend/src/quick-import/parsers/ica.parser.ts +++ b/backend/src/quick-import/parsers/ica.parser.ts @@ -25,7 +25,7 @@ export class IcaRecipeParser extends RecipeParser { const recipe = jsonData['@type'] === 'Recipe' ? jsonData - : jsonData['@graph']?.find((item) => item['@type'] === 'Recipe'); + : jsonData['@graph']?.find((item: any) => item['@type'] === 'Recipe'); if (recipe) { console.log('[IcaParser] ✓ JSON-LD recipe found'); @@ -63,12 +63,12 @@ export class IcaRecipeParser extends RecipeParser { instructions = recipe.recipeInstructions; } else if (Array.isArray(recipe.recipeInstructions)) { instructions = recipe.recipeInstructions - .map((step) => { + .map((step: any) => { if (typeof step === 'string') return step; if (step.text) return step.text; return ''; }) - .filter((s) => s) + .filter((s: string) => s) .join('\n\n'); } }