interface-forge - v2.5.0
    Preparing search index...

    Interface ZodRecord<Key, Value>

    interface ZodRecord<
        Key extends $ZodRecordKey = $ZodRecordKey,
        Value extends SomeType = $ZodType,
    > {
        _def: $ZodRecordDef<Key, Value>;
        _input: $InferZodRecordInput<Key, Value>;
        _output: $InferZodRecordOutput<Key, Value>;
        _zod: $ZodRecordInternals;
        "~standard": $ZodStandardSchema<ZodRecord<Key, Value>>;
        def: $ZodRecordDef<Key, Value>;
        description?: string;
        keyType: Key;
        spa: (
            data: unknown,
            params?: ParseContext<$ZodIssue>,
        ) => Promise<ZodSafeParseResult<$InferZodRecordOutput<Key, Value>>>;
        type: "record";
        valueType: Value;
        and<T extends SomeType>(
            incoming: T,
        ): ZodIntersection<ZodRecord<Key, Value>, T>;
        array(): ZodArray<ZodRecord<Key, Value>>;
        brand<T extends PropertyKey = PropertyKey>(
            value?: T,
        ): PropertyKey extends T
            ? ZodRecord<Key, Value>
            : $ZodBranded<ZodRecord<Key, Value>, T>;
        catch(def: $InferZodRecordOutput<Key>): ZodCatch<ZodRecord<Key, Value>>;
        catch(
            def: (ctx: $ZodCatchCtx) => $InferZodRecordOutput<Key>,
        ): ZodCatch<ZodRecord<Key, Value>>;
        check(
            ...checks: (
                | CheckFn<$InferZodRecordOutput<Key, Value>>
                | $ZodCheck<$InferZodRecordOutput<Key, Value>>
            )[],
        ): this;
        clone(def?: $ZodRecordDef<Key, Value>, params?: { parent: boolean }): this;
        default(def: $InferZodRecordOutput<Key>): ZodDefault<ZodRecord<Key, Value>>;
        default(
            def: () => NoUndefined<$InferZodRecordOutput<Key, Value>>,
        ): ZodDefault<ZodRecord<Key, Value>>;
        describe(description: string): this;
        isNullable(): boolean;
        isOptional(): boolean;
        meta(): | undefined
        | {
            deprecated?: boolean;
            description?: string;
            example?: unknown;
            examples?: | unknown[]
            | { [key: string]: { value: unknown; [key: string]: unknown } };
            id?: string;
            title?: string;
            [key: string]: unknown;
        };
        meta(
            data: {
                deprecated?: boolean;
                description?: string;
                example?: unknown;
                examples?:
                    | unknown[]
                    | { [key: string]: { value: unknown; [key: string]: unknown } };
                id?: string;
                title?: string;
                [key: string]: unknown;
            },
        ): this;
        nonoptional(
            params?:
                | string
                | {
                    error?: string
                    | $ZodErrorMap<$ZodIssueInvalidType<unknown>>;
                    message?: string;
                },
        ): ZodNonOptional<ZodRecord<Key, Value>>;
        nullable(): ZodNullable<ZodRecord<Key, Value>>;
        nullish(): ZodOptional<ZodNullable<ZodRecord<Key, Value>>>;
        optional(): ZodOptional<ZodRecord<Key, Value>>;
        or<T extends SomeType>(option: T): ZodUnion<[ZodRecord<Key, Value>, T]>;
        overwrite(
            fn: (x: $InferZodRecordOutput<Key>) => $InferZodRecordOutput<Key>,
        ): this;
        parse(
            data: unknown,
            params?: ParseContext<$ZodIssue>,
        ): $InferZodRecordOutput<Key>;
        parseAsync(
            data: unknown,
            params?: ParseContext<$ZodIssue>,
        ): Promise<$InferZodRecordOutput<Key, Value>>;
        pipe<
            T extends
                $ZodType<
                    any,
                    $InferZodRecordOutput<Key, Value>,
                    $ZodTypeInternals<any, $InferZodRecordOutput<Key, Value>>,
                >,
        >(
            target:
                | T
                | $ZodType<
                    any,
                    $InferZodRecordOutput<Key, Value>,
                    $ZodTypeInternals<any, $InferZodRecordOutput<Key, Value>>,
                >,
        ): ZodPipe<ZodRecord<Key, Value>, T>;
        prefault(
            def: () => $InferZodRecordInput<Key>,
        ): ZodPrefault<ZodRecord<Key, Value>>;
        prefault(
            def: $InferZodRecordInput<Key>,
        ): ZodPrefault<ZodRecord<Key, Value>>;
        readonly(): ZodReadonly<ZodRecord<Key, Value>>;
        refine(
            check: (arg: $InferZodRecordOutput<Key>) => unknown,
            params?:
                | string
                | {
                    abort?: boolean;
                    error?: string
                    | $ZodErrorMap<NonNullable<$ZodIssue>>;
                    message?: string;
                    params?: Record<string, any>;
                    path?: PropertyKey[];
                },
        ): this;
        register<
            R extends
                $ZodRegistry<
                    MetadataType,
                    $ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>>,
                >,
        >(
            registry: R,
            ...meta: ZodRecord<Key, Value> extends R["_schema"]
                ? undefined extends R["_meta"]
                    ? [$replace<R["_meta"], R["_schema"] & ZodRecord<Key, Value>>?]
                    : [$replace<R["_meta"], R["_schema"] & ZodRecord<Key, Value>>]
                : ["Incompatible schema"],
        ): this;
        safeParse(
            data: unknown,
            params?: ParseContext<$ZodIssue>,
        ): ZodSafeParseResult<$InferZodRecordOutput<Key, Value>>;
        safeParseAsync(
            data: unknown,
            params?: ParseContext<$ZodIssue>,
        ): Promise<ZodSafeParseResult<$InferZodRecordOutput<Key, Value>>>;
        superRefine(
            refinement: (
                arg: $InferZodRecordOutput<Key>,
                ctx: RefinementCtx<$InferZodRecordOutput<Key, Value>>,
            ) => void | Promise<void>,
        ): this;
        transform<NewOut>(
            transform: (
                arg: $InferZodRecordOutput<Key>,
                ctx: RefinementCtx<$InferZodRecordOutput<Key, Value>>,
            ) => NewOut | Promise<NewOut>,
        ): ZodPipe<
            ZodRecord<Key, Value>,
            ZodTransform<Awaited<NewOut>, $InferZodRecordOutput<Key, Value>>,
        >;
    }

    Type Parameters

    Hierarchy (View Summary)

    Index

    Properties

    Use .def instead.

    Use z.input<typeof schema> instead.

    Use z.output<typeof schema> instead.

    description?: string
    keyType: Key
    spa: (
        data: unknown,
        params?: ParseContext<$ZodIssue>,
    ) => Promise<ZodSafeParseResult<$InferZodRecordOutput<Key, Value>>>
    type: "record"
    valueType: Value

    Methods

    • Parameters

      Returns this

    • Returns a new instance that has been registered in z.globalRegistry with the specified description

      Parameters

      • description: string

      Returns this

    • Returns boolean

      Try safe-parsing null (this is what isNullable does internally):

      const schema = z.string().nullable();
      const isNullable = schema.safeParse(null).success; // true
    • Returns boolean

      Try safe-parsing undefined (this is what isOptional does internally):

      const schema = z.string().optional();
      const isOptional = schema.safeParse(undefined).success; // true
    • Returns the metadata associated with this instance in z.globalRegistry

      Returns
          | undefined
          | {
              deprecated?: boolean;
              description?: string;
              example?: unknown;
              examples?: | unknown[]
              | { [key: string]: { value: unknown; [key: string]: unknown } };
              id?: string;
              title?: string;
              [key: string]: unknown;
          }

    • Returns a new instance that has been registered in z.globalRegistry with the specified metadata

      Parameters

      • data: {
            deprecated?: boolean;
            description?: string;
            example?: unknown;
            examples?:
                | unknown[]
                | { [key: string]: { value: unknown; [key: string]: unknown } };
            id?: string;
            title?: string;
            [key: string]: unknown;
        }

      Returns this

    • Parameters

      Returns this