@illavv/run_typer - v4.1.0
    Preparing search index...

    Type Alias Infer<S, R>

    Infer: Prettify<
        { [K in RequiredKeys<S>]: ResolveSchemaValue<S[K], R> } & {
            [K in OptionalKeys<S>]?: ResolveSchemaValue<S[K], R>
        },
    >

    Derives the TypeScript type of an object that satisfies the given schema. Use directly on a schema literal — no as const required when calling parse/safeParse, thanks to the <const S> parameter.

    Pass R when the schema uses aliases registered through Typer#extend, so they resolve to their real types instead of unknown.

    Type Parameters

    • S

      The schema to derive a type from

    • R extends TypeRegistry = {}

      Custom aliases registered on the instance, if any

    const userSchema = { id: 'number', name: 'string', email: 'string?' };
    type User = Infer<typeof userSchema>;
    // → { id: number; name: string; email?: string | null }