refactor: Remove trpc/server dependency from @calcom/atoms#78
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| attendees?: number; | ||
| bookingUid?: string; | ||
| users?: string[]; | ||
| }; |
There was a problem hiding this comment.
Slot userIds type changed from number[] to string[]
Medium Severity
The Slot type defines userIds as string[], but user IDs throughout the codebase are numbers. The original type in @calcom/trpc/server/routers/viewer/slots/types correctly defined userIds?: number[]. The slot generation code in packages/features/schedules/lib/slots.ts explicitly uses userIds?: number[] in its type definitions and return values. This type mismatch will cause TypeScript type errors when consuming code expects numeric user IDs.
| userId: number | null; | ||
| eventTypeId: number | null; | ||
| days: string[]; | ||
| startTime: Date; |
There was a problem hiding this comment.
Availability days type changed from number[] to string[]
Medium Severity
The days property in the availability array is typed as string[], but the Prisma Availability model defines days as Int[] (line 941 of the schema). In TypeScript, this translates to number[]. Days represent day-of-week values (0-6), which are numeric. This type mismatch will cause TypeScript errors when consuming code expects numeric day values.
| bookingUid?: string; | ||
| away?: boolean; | ||
| fromUser?: { | ||
| id: string; |
There was a problem hiding this comment.
SlotInfo fromUser.id type changed from number to string
Medium Severity
The fromUser.id property is typed as string, but the original IFromUser interface in packages/features/availability/lib/getUserAvailability.ts defines id as number. User IDs throughout the codebase are numeric database identifiers. Notably, toUser.id in the same type is correctly typed as number, making this an inconsistency within the same type definition.
Benchmark PR from qodo-benchmark#716
Note
Decouples
@calcom/atomsfrom TRPC server types by defining and consuming local types.Slot,SlotInfo, andGetAvailableSlotsResponseinatoms/booker/typesand switches consumers (useAvailableSlots, tests) to thesehooks/schedules/typeswithSchedule-related return types,CreateScheduleInput, and a simplevalidateCreateScheduleInput; updatesuseAtomCreateSchedule,useAtomDuplicateSchedule, anduseAtomGetAllSchedulesto use themSlottype fromtrpc/server/routers/viewer/slots/types(TRPC no longer exports it)atomspackage exports to./booker/typesand adjuststsconfig/biome.jsonto restrict and remove TRPC imports@calcom/atoms/booker/typesWritten by Cursor Bugbot for commit 7f235e5. Configure here.