Skip to content

fix: resolve implicit any in event attendees mapping#214

Open
pari7maheshwari wants to merge 2 commits into
Dev-Card:mainfrom
pari7maheshwari:fix-attendee-typing
Open

fix: resolve implicit any in event attendees mapping#214
pari7maheshwari wants to merge 2 commits into
Dev-Card:mainfrom
pari7maheshwari:fix-attendee-typing

Conversation

@pari7maheshwari
Copy link
Copy Markdown

Summary

Fixes a TypeScript lint error where the attendee parameter inside the /api/events/:slug/attendees route .map() function was implicitly inferred as any. This PR improves type safety by properly typing the Prisma EventGetPayload with nested attendees and user relations, ensuring full type inference across the mapping logic.

Closes #194

Type of Change

  • Bug fix
  • New feature
  • Refactor (no functional change)
  • UI / Design change
  • Tests only
  • Documentation
  • Infrastructure / DevOps
  • Security

What Changed

  • Added 'EventWithAttendees' prisma type using 'Prisma.EventGetPayload'
  • Properly typed nested 'attendees → user' relation
  • Ensured 'event.attendees.map()' correctly infers 'attendee' type
  • Removed implicit 'any' TypeScript warning in attendees mapping
  • Improved type safety in event attendees API response

How to Test

  1. Run backend server
  2. Call endpoint:
    GET /api/events/:slug/attendees?page=1&limit=10
  3. Verify response returns correctly structured attendees list
  4. Run typecheck to confirm no TypeScript errors:
    pnpm -r run typecheck
  5. Run lint to confirm no warnings:
    pnpm -r run lint

Checklist

  • My code follows the project's coding style (pnpm -r run lint passes).
  • TypeScript compiles without errors (pnpm -r run typecheck).
  • I have added or updated tests for the changes I made.
  • All tests pass locally (pnpm -r run test).
  • I have updated documentation where necessary.
  • No new console.log or debug statements left in the code.
  • Breaking changes are documented in this PR description.

Screenshots / Recordings

Not applicable (backend-only change).

Additional Context

This change only improves TypeScript inference and does not modify runtime behavior or API response structure. It ensures safer maintenance for future changes involving nested Prisma relations in event attendee queries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve type safety in event attendees mapping

1 participant