Creating Optional Fields with `@effect/schema`

How would I do this with @effect/schema?

const user = z.object({
  email: z.string(),
  username: z.string(),
});

const optionalEmail = user.partial({
  email: true,
});

it seems you can't do something like
const user = S.Struct({
  email: S.String,
  username: S.String
})

const optionalEmail = S.partial(user, {
  email: true
});
Was this page helpful?