Membrane SDK - v0.8.0
    Preparing search index...

    Interface ZodCoercedNumber<T>

    interface ZodCoercedNumber<T = unknown> {
        def: $ZodNumberDef;
        type: "number";
        _def: $ZodNumberDef;
        _output: number;
        _input: T;
        check(...checks: ($ZodCheck<number> | CheckFn<number>)[]): this;
        clone(def?: $ZodNumberDef, params?: { parent: boolean }): this;
        register<
            R extends
                $ZodRegistry<
                    MetadataType,
                    $ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>>,
                >,
        >(
            registry: R,
            ...meta: ZodCoercedNumber<T> extends R["_schema"]
                ? undefined extends R["_meta"]
                    ? [$replace<R["_meta"], R["_schema"] & ZodCoercedNumber<T>>?]
                    : [$replace<R["_meta"], R["_schema"] & ZodCoercedNumber<T>>]
                : ["Incompatible schema"],
        ): this;
        brand<T extends PropertyKey = PropertyKey>(
            value?: T,
        ): PropertyKey extends T
            ? ZodCoercedNumber<T>
            : $ZodBranded<ZodCoercedNumber<T>, T>;
        parse(data: unknown, params?: ParseContext<$ZodIssue>): number;
        safeParse(
            data: unknown,
            params?: ParseContext<$ZodIssue>,
        ): ZodSafeParseResult<number>;
        parseAsync(
            data: unknown,
            params?: ParseContext<$ZodIssue>,
        ): Promise<number>;
        safeParseAsync(
            data: unknown,
            params?: ParseContext<$ZodIssue>,
        ): Promise<ZodSafeParseResult<number>>;
        spa: (
            data: unknown,
            params?: ParseContext<$ZodIssue>,
        ) => Promise<ZodSafeParseResult<number>>;
        encode(data: number, params?: ParseContext<$ZodIssue>): T;
        decode(data: T, params?: ParseContext<$ZodIssue>): number;
        encodeAsync(data: number, params?: ParseContext<$ZodIssue>): Promise<T>;
        decodeAsync(data: T, params?: ParseContext<$ZodIssue>): Promise<number>;
        safeEncode(
            data: number,
            params?: ParseContext<$ZodIssue>,
        ): ZodSafeParseResult<T>;
        safeDecode(
            data: T,
            params?: ParseContext<$ZodIssue>,
        ): ZodSafeParseResult<number>;
        safeEncodeAsync(
            data: number,
            params?: ParseContext<$ZodIssue>,
        ): Promise<ZodSafeParseResult<T>>;
        safeDecodeAsync(
            data: T,
            params?: ParseContext<$ZodIssue>,
        ): Promise<ZodSafeParseResult<number>>;
        refine(
            check: (arg: number) => unknown,
            params?:
                | string
                | {
                    error?: string
                    | $ZodErrorMap<NonNullable<$ZodIssue>>;
                    message?: string;
                    abort?: boolean;
                    when?: (payload: ParsePayload) => boolean;
                    path?: PropertyKey[];
                    params?: Record<string, any>;
                },
        ): this;
        superRefine(
            refinement: (
                arg: number,
                ctx: $RefinementCtx<number>,
            ) => void | Promise<void>,
        ): this;
        overwrite(fn: (x: number) => number): this;
        optional(): ZodOptional<ZodCoercedNumber<T>>;
        nonoptional(
            params?:
                | string
                | {
                    error?: string
                    | $ZodErrorMap<$ZodIssueInvalidType<unknown>>;
                    message?: string;
                },
        ): ZodNonOptional<ZodCoercedNumber<T>>;
        nullable(): ZodNullable<ZodCoercedNumber<T>>;
        nullish(): ZodOptional<ZodNullable<ZodCoercedNumber<T>>>;
        default(def: number): ZodDefault<ZodCoercedNumber<T>>;
        default(def: () => number): ZodDefault<ZodCoercedNumber<T>>;
        prefault(def: () => T): ZodPrefault<ZodCoercedNumber<T>>;
        prefault(def: T): ZodPrefault<ZodCoercedNumber<T>>;
        array(): ZodArray<ZodCoercedNumber<T>>;
        or<T extends SomeType>(option: T): ZodUnion<[ZodCoercedNumber<T>, T]>;
        and<T extends SomeType>(
            incoming: T,
        ): ZodIntersection<ZodCoercedNumber<T>, T>;
        transform<NewOut>(
            transform: (
                arg: number,
                ctx: $RefinementCtx<number>,
            ) => NewOut | Promise<NewOut>,
        ): ZodPipe<ZodCoercedNumber<T>, ZodTransform<Awaited<NewOut>, number>>;
        catch(def: number): ZodCatch<ZodCoercedNumber<T>>;
        catch(def: (ctx: $ZodCatchCtx) => number): ZodCatch<ZodCoercedNumber<T>>;
        pipe<T extends $ZodType<any, number, $ZodTypeInternals<any, number>>>(
            target: $ZodType<any, number, $ZodTypeInternals<any, number>> | T,
        ): ZodPipe<ZodCoercedNumber<T>, T>;
        readonly(): ZodReadonly<ZodCoercedNumber<T>>;
        describe(description: string): this;
        description?: string;
        meta(): | undefined
        | {
            id?: string;
            title?: string;
            description?: string;
            deprecated?: boolean;
            [key: string]: unknown;
        };
        meta(
            data: {
                id?: string;
                title?: string;
                description?: string;
                deprecated?: boolean;
                [key: string]: unknown;
            },
        ): this;
        isOptional(): boolean;
        isNullable(): boolean;
        gt(
            value: number,
            params?:
                | string
                | {
                    error?: string
                    | $ZodErrorMap<$ZodIssueTooSmall<Numeric>>;
                    message?: string;
                    abort?: boolean;
                },
        ): this;
        gte(
            value: number,
            params?:
                | string
                | {
                    error?: string
                    | $ZodErrorMap<$ZodIssueTooSmall<Numeric>>;
                    message?: string;
                    abort?: boolean;
                },
        ): this;
        min(
            value: number,
            params?:
                | string
                | {
                    error?: string
                    | $ZodErrorMap<$ZodIssueTooSmall<Numeric>>;
                    message?: string;
                    abort?: boolean;
                },
        ): this;
        lt(
            value: number,
            params?:
                | string
                | {
                    error?: string
                    | $ZodErrorMap<$ZodIssueTooBig<Numeric>>;
                    message?: string;
                    abort?: boolean;
                },
        ): this;
        lte(
            value: number,
            params?:
                | string
                | {
                    error?: string
                    | $ZodErrorMap<$ZodIssueTooBig<Numeric>>;
                    message?: string;
                    abort?: boolean;
                },
        ): this;
        max(
            value: number,
            params?:
                | string
                | {
                    error?: string
                    | $ZodErrorMap<$ZodIssueTooBig<Numeric>>;
                    message?: string;
                    abort?: boolean;
                },
        ): this;
        int(
            params?:
                | string
                | {
                    error?: | string
                    | $ZodErrorMap<
                        NonNullable<
                            | $ZodIssueInvalidType<unknown>
                            | $ZodIssueTooBig<"number">
                            | $ZodIssueTooSmall<"number">,
                        >,
                    >;
                    message?: string;
                    abort?: boolean;
                },
        ): this;
        safe(
            params?:
                | string
                | {
                    error?: | string
                    | $ZodErrorMap<
                        NonNullable<
                            | $ZodIssueInvalidType<unknown>
                            | $ZodIssueTooBig<"number">
                            | $ZodIssueTooSmall<"number">,
                        >,
                    >;
                    message?: string;
                    abort?: boolean;
                },
        ): this;
        positive(
            params?:
                | string
                | {
                    error?: string
                    | $ZodErrorMap<$ZodIssueTooSmall<Numeric>>;
                    message?: string;
                    abort?: boolean;
                },
        ): this;
        nonnegative(
            params?:
                | string
                | {
                    error?: string
                    | $ZodErrorMap<$ZodIssueTooSmall<Numeric>>;
                    message?: string;
                    abort?: boolean;
                },
        ): this;
        negative(
            params?:
                | string
                | {
                    error?: string
                    | $ZodErrorMap<$ZodIssueTooBig<Numeric>>;
                    message?: string;
                    abort?: boolean;
                },
        ): this;
        nonpositive(
            params?:
                | string
                | {
                    error?: string
                    | $ZodErrorMap<$ZodIssueTooBig<Numeric>>;
                    message?: string;
                    abort?: boolean;
                },
        ): this;
        multipleOf(
            value: number,
            params?:
                | string
                | {
                    error?: | string
                    | $ZodErrorMap<$ZodIssueNotMultipleOf<number | bigint>>;
                    message?: string;
                    abort?: boolean;
                },
        ): this;
        step(
            value: number,
            params?:
                | string
                | {
                    error?: | string
                    | $ZodErrorMap<$ZodIssueNotMultipleOf<number | bigint>>;
                    message?: string;
                    abort?: boolean;
                },
        ): this;
        finite(params?: unknown): this;
        minValue: null | number;
        maxValue: null | number;
        isInt: boolean;
        isFinite: boolean;
        format: null | string;
        _zod: $ZodNumberInternals;
        "~standard": $ZodStandardSchema<ZodCoercedNumber<T>>;
    }

    Type Parameters

    • T = unknown

    Hierarchy (View Summary)

    Index

    Properties

    type: "number"

    Use .def instead.

    _output: number

    Use z.output<typeof schema> instead.

    _input: T

    Use z.input<typeof schema> instead.

    spa: (
        data: unknown,
        params?: ParseContext<$ZodIssue>,
    ) => Promise<ZodSafeParseResult<number>>
    description?: string
    minValue: null | number
    maxValue: null | number
    isInt: boolean

    Check the format property instead.

    isFinite: boolean

    Number schemas no longer accept infinite values, so this always returns true.

    format: null | string

    Methods

    • Parameters

      Returns this

    • Parameters

      • check: (arg: number) => unknown
      • Optionalparams:
            | string
            | {
                error?: string
                | $ZodErrorMap<NonNullable<$ZodIssue>>;
                message?: string;
                abort?: boolean;
                when?: (payload: ParsePayload) => boolean;
                path?: PropertyKey[];
                params?: Record<string, any>;
            }
        • string
        • {
              error?: string | $ZodErrorMap<NonNullable<$ZodIssue>>;
              message?: string;
              abort?: boolean;
              when?: (payload: ParsePayload) => boolean;
              path?: PropertyKey[];
              params?: Record<string, any>;
          }
          • Optionalerror?: string | $ZodErrorMap<NonNullable<$ZodIssue>>
          • Optionalmessage?: string

            This parameter is deprecated. Use error instead.

          • Optionalabort?: boolean

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

          • Optionalwhen?: (payload: ParsePayload) => boolean

            If provided, this check will only be executed if the function returns true. Defaults to payload => z.util.isAborted(payload).

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

      Returns this

    • Parameters

      • refinement: (arg: number, ctx: $RefinementCtx<number>) => void | Promise<void>

      Returns this

    • Parameters

      • fn: (x: number) => number

      Returns this

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

      Parameters

      • description: string

      Returns this

    • Returns the metadata associated with this instance in z.globalRegistry

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

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

      Parameters

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

      Returns this

    • 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 boolean

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

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

      • value: number
      • Optionalparams:
            | string
            | {
                error?: string
                | $ZodErrorMap<$ZodIssueTooSmall<Numeric>>;
                message?: string;
                abort?: boolean;
            }
        • string
        • {
              error?: string | $ZodErrorMap<$ZodIssueTooSmall<Numeric>>;
              message?: string;
              abort?: boolean;
          }
          • Optionalerror?: string | $ZodErrorMap<$ZodIssueTooSmall<Numeric>>
          • Optionalmessage?: string

            This parameter is deprecated. Use error instead.

          • Optionalabort?: boolean

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

      Returns this

    • Identical to .min()

      Parameters

      • value: number
      • Optionalparams:
            | string
            | {
                error?: string
                | $ZodErrorMap<$ZodIssueTooSmall<Numeric>>;
                message?: string;
                abort?: boolean;
            }
        • string
        • {
              error?: string | $ZodErrorMap<$ZodIssueTooSmall<Numeric>>;
              message?: string;
              abort?: boolean;
          }
          • Optionalerror?: string | $ZodErrorMap<$ZodIssueTooSmall<Numeric>>
          • Optionalmessage?: string

            This parameter is deprecated. Use error instead.

          • Optionalabort?: boolean

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

      Returns this

    • Parameters

      • value: number
      • Optionalparams:
            | string
            | {
                error?: string
                | $ZodErrorMap<$ZodIssueTooSmall<Numeric>>;
                message?: string;
                abort?: boolean;
            }
        • string
        • {
              error?: string | $ZodErrorMap<$ZodIssueTooSmall<Numeric>>;
              message?: string;
              abort?: boolean;
          }
          • Optionalerror?: string | $ZodErrorMap<$ZodIssueTooSmall<Numeric>>
          • Optionalmessage?: string

            This parameter is deprecated. Use error instead.

          • Optionalabort?: boolean

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

      Returns this

    • Parameters

      • value: number
      • Optionalparams:
            | string
            | {
                error?: string
                | $ZodErrorMap<$ZodIssueTooBig<Numeric>>;
                message?: string;
                abort?: boolean;
            }
        • string
        • {
              error?: string | $ZodErrorMap<$ZodIssueTooBig<Numeric>>;
              message?: string;
              abort?: boolean;
          }
          • Optionalerror?: string | $ZodErrorMap<$ZodIssueTooBig<Numeric>>
          • Optionalmessage?: string

            This parameter is deprecated. Use error instead.

          • Optionalabort?: boolean

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

      Returns this

    • Identical to .max()

      Parameters

      • value: number
      • Optionalparams:
            | string
            | {
                error?: string
                | $ZodErrorMap<$ZodIssueTooBig<Numeric>>;
                message?: string;
                abort?: boolean;
            }
        • string
        • {
              error?: string | $ZodErrorMap<$ZodIssueTooBig<Numeric>>;
              message?: string;
              abort?: boolean;
          }
          • Optionalerror?: string | $ZodErrorMap<$ZodIssueTooBig<Numeric>>
          • Optionalmessage?: string

            This parameter is deprecated. Use error instead.

          • Optionalabort?: boolean

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

      Returns this

    • Parameters

      • value: number
      • Optionalparams:
            | string
            | {
                error?: string
                | $ZodErrorMap<$ZodIssueTooBig<Numeric>>;
                message?: string;
                abort?: boolean;
            }
        • string
        • {
              error?: string | $ZodErrorMap<$ZodIssueTooBig<Numeric>>;
              message?: string;
              abort?: boolean;
          }
          • Optionalerror?: string | $ZodErrorMap<$ZodIssueTooBig<Numeric>>
          • Optionalmessage?: string

            This parameter is deprecated. Use error instead.

          • Optionalabort?: boolean

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

      Returns this

    • Consider z.int() instead. This API is considered legacy; it will never be removed but a better alternative exists.

      Parameters

      • Optionalparams:
            | string
            | {
                error?: | string
                | $ZodErrorMap<
                    NonNullable<
                        | $ZodIssueInvalidType<unknown>
                        | $ZodIssueTooBig<"number">
                        | $ZodIssueTooSmall<"number">,
                    >,
                >;
                message?: string;
                abort?: boolean;
            }
        • string
        • {
              error?:
                  | string
                  | $ZodErrorMap<
                      NonNullable<
                          | $ZodIssueInvalidType<unknown>
                          | $ZodIssueTooBig<"number">
                          | $ZodIssueTooSmall<"number">,
                      >,
                  >;
              message?: string;
              abort?: boolean;
          }
          • Optionalerror?:
                | string
                | $ZodErrorMap<
                    NonNullable<
                        | $ZodIssueInvalidType<unknown>
                        | $ZodIssueTooBig<"number">
                        | $ZodIssueTooSmall<"number">,
                    >,
                >
          • Optionalmessage?: string

            This parameter is deprecated. Use error instead.

          • Optionalabort?: boolean

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

      Returns this

    • Parameters

      • Optionalparams:
            | string
            | {
                error?: | string
                | $ZodErrorMap<
                    NonNullable<
                        | $ZodIssueInvalidType<unknown>
                        | $ZodIssueTooBig<"number">
                        | $ZodIssueTooSmall<"number">,
                    >,
                >;
                message?: string;
                abort?: boolean;
            }
        • string
        • {
              error?:
                  | string
                  | $ZodErrorMap<
                      NonNullable<
                          | $ZodIssueInvalidType<unknown>
                          | $ZodIssueTooBig<"number">
                          | $ZodIssueTooSmall<"number">,
                      >,
                  >;
              message?: string;
              abort?: boolean;
          }
          • Optionalerror?:
                | string
                | $ZodErrorMap<
                    NonNullable<
                        | $ZodIssueInvalidType<unknown>
                        | $ZodIssueTooBig<"number">
                        | $ZodIssueTooSmall<"number">,
                    >,
                >
          • Optionalmessage?: string

            This parameter is deprecated. Use error instead.

          • Optionalabort?: boolean

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

      Returns this

      This is now identical to .int(). Only numbers in the safe integer range are accepted.

    • Parameters

      • Optionalparams:
            | string
            | {
                error?: string
                | $ZodErrorMap<$ZodIssueTooSmall<Numeric>>;
                message?: string;
                abort?: boolean;
            }
        • string
        • {
              error?: string | $ZodErrorMap<$ZodIssueTooSmall<Numeric>>;
              message?: string;
              abort?: boolean;
          }
          • Optionalerror?: string | $ZodErrorMap<$ZodIssueTooSmall<Numeric>>
          • Optionalmessage?: string

            This parameter is deprecated. Use error instead.

          • Optionalabort?: boolean

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

      Returns this

    • Parameters

      • Optionalparams:
            | string
            | {
                error?: string
                | $ZodErrorMap<$ZodIssueTooSmall<Numeric>>;
                message?: string;
                abort?: boolean;
            }
        • string
        • {
              error?: string | $ZodErrorMap<$ZodIssueTooSmall<Numeric>>;
              message?: string;
              abort?: boolean;
          }
          • Optionalerror?: string | $ZodErrorMap<$ZodIssueTooSmall<Numeric>>
          • Optionalmessage?: string

            This parameter is deprecated. Use error instead.

          • Optionalabort?: boolean

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

      Returns this

    • Parameters

      • Optionalparams:
            | string
            | {
                error?: string
                | $ZodErrorMap<$ZodIssueTooBig<Numeric>>;
                message?: string;
                abort?: boolean;
            }
        • string
        • {
              error?: string | $ZodErrorMap<$ZodIssueTooBig<Numeric>>;
              message?: string;
              abort?: boolean;
          }
          • Optionalerror?: string | $ZodErrorMap<$ZodIssueTooBig<Numeric>>
          • Optionalmessage?: string

            This parameter is deprecated. Use error instead.

          • Optionalabort?: boolean

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

      Returns this

    • Parameters

      • Optionalparams:
            | string
            | {
                error?: string
                | $ZodErrorMap<$ZodIssueTooBig<Numeric>>;
                message?: string;
                abort?: boolean;
            }
        • string
        • {
              error?: string | $ZodErrorMap<$ZodIssueTooBig<Numeric>>;
              message?: string;
              abort?: boolean;
          }
          • Optionalerror?: string | $ZodErrorMap<$ZodIssueTooBig<Numeric>>
          • Optionalmessage?: string

            This parameter is deprecated. Use error instead.

          • Optionalabort?: boolean

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

      Returns this

    • Parameters

      • value: number
      • Optionalparams:
            | string
            | {
                error?: string
                | $ZodErrorMap<$ZodIssueNotMultipleOf<number | bigint>>;
                message?: string;
                abort?: boolean;
            }
        • string
        • {
              error?: string | $ZodErrorMap<$ZodIssueNotMultipleOf<number | bigint>>;
              message?: string;
              abort?: boolean;
          }
          • Optionalerror?: string | $ZodErrorMap<$ZodIssueNotMultipleOf<number | bigint>>
          • Optionalmessage?: string

            This parameter is deprecated. Use error instead.

          • Optionalabort?: boolean

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

      Returns this

    • Parameters

      • value: number
      • Optionalparams:
            | string
            | {
                error?: string
                | $ZodErrorMap<$ZodIssueNotMultipleOf<number | bigint>>;
                message?: string;
                abort?: boolean;
            }
        • string
        • {
              error?: string | $ZodErrorMap<$ZodIssueNotMultipleOf<number | bigint>>;
              message?: string;
              abort?: boolean;
          }
          • Optionalerror?: string | $ZodErrorMap<$ZodIssueNotMultipleOf<number | bigint>>
          • Optionalmessage?: string

            This parameter is deprecated. Use error instead.

          • Optionalabort?: boolean

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

      Returns this

      Use .multipleOf() instead.

    • Parameters

      • Optionalparams: unknown

      Returns this

      In v4 and later, z.number() does not allow infinite values by default. This is a no-op.