Skip to main content

partial

Creates a clone if the given object schema with all properties set to optional. Note that this operation is performed shallowly. If you also want nested properties to be optional, you need to use deepPartial.

Example​

import { partial, object, string } from "@sodd/core";

const userSchema = object({
name: string(),
location: string(),
});

const partialUserSchema = partial(userSchema);

partialUserSchema.parse({}); // ✅