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

    Interface ZodMap<Key, Value>

    interface ZodMap<
        Key extends SomeType = $ZodType,
        Value extends SomeType = $ZodType,
    > {
        _def: $ZodMapDef<Key, Value>;
        _input: Map<input<Key>, input<Value>>;
        _output: Map<output<Key>, output<Value>>;
        _zod: $ZodMapInternals;
        "~standard": $ZodStandardSchema<ZodMap<Key, Value>>;
        def: $ZodMapDef<Key, Value>;
        description?: string;
        keyType: Key;
        spa: (
            data: unknown,
            params?: ParseContext<$ZodIssue>,
        ) => Promise<ZodSafeParseResult<Map<output<Key>, output<Value>>>>;
        type: "map";
        valueType: Value;
        and<T extends SomeType>(
            incoming: T,
        ): ZodIntersection<ZodMap<Key, Value>, T>;
        array(): ZodArray<ZodMap<Key, Value>>;
        brand<T extends PropertyKey = PropertyKey>(
            value?: T,
        ): PropertyKey extends T
            ? ZodMap<Key, Value>
            : $ZodBranded<ZodMap<Key, Value>, T>;
        catch(def: Map<output<Key>>): ZodCatch<ZodMap<Key, Value>>;
        catch(
            def: (ctx: $ZodCatchCtx) => Map<output<Key>>,
        ): ZodCatch<ZodMap<Key, Value>>;
        check(
            ...checks: (
                | CheckFn<Map<output<Key>, output<Value>>>
                | $ZodCheck<Map<output<Key>, output<Value>>>
            )[],
        ): this;
        clone(def?: $ZodMapDef<Key, Value>, params?: { parent: boolean }): this;
        default(def: Map<output<Key>>): ZodDefault<ZodMap<Key, Value>>;
        default(def: () => Map<output<Key>>): ZodDefault<ZodMap<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<ZodMap<Key, Value>>;
        nullable(): ZodNullable<ZodMap<Key, Value>>;
        nullish(): ZodOptional<ZodNullable<ZodMap<Key, Value>>>;
        optional(): ZodOptional<ZodMap<Key, Value>>;
        or<T extends SomeType>(option: T): ZodUnion<[ZodMap<Key, Value>, T]>;
        overwrite(fn: (x: Map<output<Key>>) => Map<output<Key>>): this;
        parse(data: unknown, params?: ParseContext<$ZodIssue>): Map<output<Key>>;
        parseAsync(
            data: unknown,
            params?: ParseContext<$ZodIssue>,
        ): Promise<Map<output<Key>, output<Value>>>;
        pipe<
            T extends
                $ZodType<
                    any,
                    Map<output<Key>, output<Value>>,
                    $ZodTypeInternals<any, Map<output<Key>, output<Value>>>,
                >,
        >(
            target:
                | T
                | $ZodType<
                    any,
                    Map<output<Key>, output<Value>>,
                    $ZodTypeInternals<any, Map<output<Key>, output<Value>>>,
                >,
        ): ZodPipe<ZodMap<Key, Value>, T>;
        prefault(def: () => Map<input<Key>>): ZodPrefault<ZodMap<Key, Value>>;
        prefault(def: Map<input<Key>>): ZodPrefault<ZodMap<Key, Value>>;
        readonly(): ZodReadonly<ZodMap<Key, Value>>;
        refine(
            check: (arg: Map<output<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: ZodMap<Key, Value> extends R["_schema"]
                ? undefined extends R["_meta"]
                    ? [$replace<R["_meta"], R["_schema"] & ZodMap<Key, Value>>?]
                    : [$replace<R["_meta"], R["_schema"] & ZodMap<Key, Value>>]
                : ["Incompatible schema"],
        ): this;
        safeParse(
            data: unknown,
            params?: ParseContext<$ZodIssue>,
        ): ZodSafeParseResult<Map<output<Key>, output<Value>>>;
        safeParseAsync(
            data: unknown,
            params?: ParseContext<$ZodIssue>,
        ): Promise<ZodSafeParseResult<Map<output<Key>, output<Value>>>>;
        superRefine(
            refinement: (
                arg: Map<output<Key>>,
                ctx: RefinementCtx<Map<output<Key>, output<Value>>>,
            ) => void | Promise<void>,
        ): this;
        transform<NewOut>(
            transform: (
                arg: Map<output<Key>>,
                ctx: RefinementCtx<Map<output<Key>, output<Value>>>,
            ) => NewOut | Promise<NewOut>,
        ): ZodPipe<
            ZodMap<Key, Value>,
            ZodTransform<Awaited<NewOut>, Map<output<Key>, output<Value>>>,
        >;
    }

    Type Parameters

    Hierarchy (View Summary)

    Index

    Properties

    Use .def instead.

    _input: Map<input<Key>, input<Value>>

    Use z.input<typeof schema> instead.

    _output: Map<output<Key>, output<Value>>

    Use z.output<typeof schema> instead.

    description?: string
    keyType: Key
    spa: (
        data: unknown,
        params?: ParseContext<$ZodIssue>,
    ) => Promise<ZodSafeParseResult<Map<output<Key>, output<Value>>>>
    type: "map"
    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

      • check: (arg: Map<output<Key>>) => unknown
      • Optionalparams:
            | string
            | {
                abort?: boolean;
                error?: string
                | $ZodErrorMap<NonNullable<$ZodIssue>>;
                message?: string;
                params?: Record<string, any>;
                path?: PropertyKey[];
            }
        • string
        • {
              abort?: boolean;
              error?: string | $ZodErrorMap<NonNullable<$ZodIssue>>;
              message?: string;
              params?: Record<string, any>;
              path?: PropertyKey[];
          }
          • Optionalabort?: boolean

            If true, no later checks will be executed if this check fails. Default false.

          • Optionalerror?: string | $ZodErrorMap<NonNullable<$ZodIssue>>
          • Optionalmessage?: string

            This parameter is deprecated. Use error instead.

          • Optionalparams?: Record<string, any>
          • Optionalpath?: PropertyKey[]

      Returns this

    • Type Parameters

      Parameters

      Returns this