Libraries
    Preparing search index...

    Type Alias InferType<T>

    InferType: T extends {
        optimize: (
            ...args: any[],
        ) => { readonly [K in SchemaTypeBrand]: infer TOptimized };
    }
        ? TOptimized
        : T extends { readonly [K in SchemaTypeBrand]: infer TType } ? TType : T

    Infers the TypeScript type that a SchemaBuilder instance validates. Takes into account type optimizations (via optimize()) and whether the schema is optional.

    Type Parameters

    • T
    const userSchema = object({ name: string(), age: number().optional() });
    type User = InferType<typeof userSchema>;
    // { name: string; age?: number }