fix: Add type annotations for better type safety in recipe parsers
This commit is contained in:
@@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user