Object Methods in Zod

From the Zod cheat sheet · Object Schemas · verified Jul 2026

Object Methods

Transform existing object schemas with extend, pick, omit, partial

typescript
const UserSchema = z.object({
  id: z.uuid(),
  name: z.string(),
  email: z.email(),
});

const PublicUser = UserSchema.omit({ email: true });
const UserUpdate = UserSchema.partial();
const AdminUser = UserSchema.extend({ role: z.string() });
💡 .pick() and .omit() take an object with true values, not an array of keys
⚡ .partial() is perfect for PATCH update endpoints where any field is optional
📌 .extend() takes priority over the original — duplicate keys are overridden
🟢 Use .keyof() to get an enum of all valid keys for type-safe field references
objectpickomitextend

More Zod tasks

Back to the full Zod cheat sheet