From eaead43e120f03fbebd3c689ee0833d36e7ff02e Mon Sep 17 00:00:00 2001 From: Starstrike Date: Thu, 1 May 2025 17:44:39 -0400 Subject: [PATCH] Fix TypeScript error: Add RSVP interface to properly type the rsvp parameter in map function --- backend/src/index.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/backend/src/index.ts b/backend/src/index.ts index ecf85a6..f279b6f 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -25,6 +25,18 @@ app.use('/uploads', express.static(path.join(__dirname, '../uploads'))); // Database connection let db: any; +interface RSVP { + id: number; + event_id: number; + name: string; + attending: string; + bringing_guests: string; + guest_count: number; + guest_names: string | null; + items_bringing: string | null; + created_at?: string; +} + async function connectToDatabase() { try { // Database file will be in the app directory @@ -216,7 +228,7 @@ app.get('/api/events/:slug/rsvps', async (req: Request, res: Response) => { const rows = await db.all('SELECT * FROM rsvps WHERE event_id = ?', [eventId]); // Parse JSON arrays in each RSVP - const parsedRows = rows.map(rsvp => { + const parsedRows = rows.map((rsvp: RSVP) => { try { return { ...rsvp,