perf: add z.ZodType annotations to high-impact schemas (#26114)
* perf: add z.ZodType annotations to high-impact schemas Add explicit type annotations to reduce TypeScript type inference overhead and .d.ts file bloat in the tRPC package. Changes: - packages/prisma/zod-utils.ts: Add EventTypeLocation type and annotate eventTypeLocations schema - packages/features/eventtypes/lib/schemas.ts: Add TEventTypeDuplicateInput and TCreateEventTypeInput types with annotations - packages/app-store/routing-forms/zod.ts: Add FieldOption, TNonRouterField, TRouterField, TField, TFields types with annotations for zodField and zodFields These schemas feed into multiple tRPC routers and were identified as high-impact targets for reducing type checking time and declaration file sizes. Co-Authored-By: [email protected] <[email protected]> * fix: replace z.infer with explicit types and define EventTypeLocation locally Address PR feedback: - Replace z.infer<typeof calVideoSettingsSchema> with explicit CalVideoSettings type - Define EventTypeLocation type locally instead of importing from prisma - Add z.ZodType annotation to calVideoSettingsSchema Note: Still importing Zod schemas from @calcom/prisma/zod-utils for validation. Awaiting guidance on whether to move those to @calcom/lib. Co-Authored-By: [email protected] <[email protected]> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
ee6989a575
commit
851cca25aa
3 files changed
+100
-6
No files matched your search
@@ -327,7 +327,18 @@ export const bookingResponses = z
|
||||
|
||||
export type BookingResponses = z.infer<typeof bookingResponses>;
|
||||
|
||||
export const eventTypeLocations = z.array(
|
||||
export type EventTypeLocation = {
|
||||
type: string;
|
||||
address?: string;
|
||||
link?: string;
|
||||
displayLocationPublicly?: boolean;
|
||||
hostPhoneNumber?: string;
|
||||
credentialId?: number;
|
||||
teamName?: string;
|
||||
customLabel?: string;
|
||||
};
|
||||
|
||||
export const eventTypeLocations: z.ZodType<EventTypeLocation[]> = z.array(
|
||||
z.object({
|
||||
// TODO: Couldn't find a way to make it a union of types from App Store locations
|
||||
// Creating a dynamic union by iterating over the object doesn't seem to make TS happy
|
||||
|
||||
Reference in new issue
Block a user