diff --git a/packages/zod/src/types.ts b/packages/zod/src/types.ts index 7715a534d..8258363c1 100644 --- a/packages/zod/src/types.ts +++ b/packages/zod/src/types.ts @@ -106,10 +106,10 @@ type FieldTypeZodMap = { Int: z.ZodNumber; BigInt: z.ZodBigInt; Float: z.ZodNumber; - Decimal: z.ZodType; + Decimal: z.ZodType; Boolean: z.ZodBoolean; - DateTime: z.ZodType; - Bytes: z.ZodType; + DateTime: z.ZodDate; + Bytes: z.ZodType; Json: JsonZodType; }; diff --git a/packages/zod/test/factory.test.ts b/packages/zod/test/factory.test.ts index 0dd616c2d..43afddc85 100644 --- a/packages/zod/test/factory.test.ts +++ b/packages/zod/test/factory.test.ts @@ -208,6 +208,14 @@ describe('SchemaFactory - makeModelSchema', () => { expect(userSchema.safeParse({ ...validUser, metadata: { key: BigInt(1) } }).success).toBe(false); expect(userSchema.safeParse({ ...validUser, metadata: [BigInt(1)] }).success).toBe(false); }); + + it('infers correct input types for fields', () => { + const _userSchema = factory.makeModelSchema('User'); + type UserInput = z.input; + expectTypeOf().toEqualTypeOf(); + expectTypeOf().toEqualTypeOf(); + expectTypeOf().toEqualTypeOf(); + }); }); describe('string validation attributes', () => {