Infers the TypeScript type that a SchemaBuilder instance validates. Takes into account type optimizations (via optimize()) and whether the schema is optional.
SchemaBuilder
optimize()
const userSchema = object({ name: string(), age: number().optional() });type User = InferType<typeof userSchema>;// { name: string; age?: number } Copy
const userSchema = object({ name: string(), age: number().optional() });type User = InferType<typeof userSchema>;// { name: string; age?: number }
Infers the TypeScript type that a
SchemaBuilderinstance validates. Takes into account type optimizations (viaoptimize()) and whether the schema is optional.