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

    Interface _ZodString<T>

    interface _ZodString<
        T extends $ZodStringInternals<unknown> = $ZodStringInternals<unknown>,
    > {
        _def: T["def"];
        _input: T["input"];
        _output: T["output"];
        _zod: T;
        "~standard": $ZodStandardSchema<_ZodString<T>>;
        def: T["def"];
        description?: string;
        format: null | string;
        maxLength: null | number;
        minLength: null | number;
        spa: (
            data: unknown,
            params?: ParseContext<$ZodIssue>,
        ) => Promise<ZodSafeParseResult<output<_ZodString<T>>>>;
        type: T["def"]["type"];
        and<T extends SomeType>(incoming: T): ZodIntersection<_ZodString<T>, T>;
        array(): ZodArray<_ZodString<T>>;
        brand<T extends PropertyKey = PropertyKey>(
            value?: T,
        ): PropertyKey extends T ? _ZodString<T> : $ZodBranded<_ZodString<T>, T>;
        catch(def: output<_ZodString<T>>): ZodCatch<_ZodString<T>>;
        catch(
            def: (ctx: $ZodCatchCtx) => output<_ZodString<T>>,
        ): ZodCatch<_ZodString<T>>;
        check(
            ...checks: (
                CheckFn<output<_ZodString<T>>>
                | $ZodCheck<output<_ZodString<T>>>
            )[],
        ): this;
        clone(def?: T["def"], params?: { parent: boolean }): this;
        default(def: output<_ZodString<T>>): ZodDefault<_ZodString<T>>;
        default(
            def: () => NoUndefined<output<_ZodString<T>>>,
        ): ZodDefault<_ZodString<T>>;
        describe(description: string): this;
        endsWith(
            value: string,
            params?:
                | string
                | {
                    abort?: boolean;
                    error?: string
                    | $ZodErrorMap<$ZodIssueInvalidStringFormat>;
                    message?: string;
                },
        ): this;
        includes(
            value: string,
            params?: {
                abort?: boolean;
                error?: string | $ZodErrorMap<$ZodIssueInvalidStringFormat>;
                message?: string;
                position?: number;
            },
        ): this;
        isNullable(): boolean;
        isOptional(): boolean;
        length(
            len: number,
            params?:
                | string
                | {
                    abort?: boolean;
                    error?: | string
                    | $ZodErrorMap<
                        NonNullable<
                            $ZodIssueTooSmall<HasLength>
                            | $ZodIssueTooBig<HasLength>,
                        >,
                    >;
                    message?: string;
                },
        ): this;
        lowercase(
            params?:
                | string
                | {
                    abort?: boolean;
                    error?: string
                    | $ZodErrorMap<$ZodIssueInvalidStringFormat>;
                    message?: string;
                    pattern?: RegExp;
                },
        ): this;
        max(
            maxLength: number,
            params?:
                | string
                | {
                    abort?: boolean;
                    error?: string
                    | $ZodErrorMap<$ZodIssueTooBig<HasLength>>;
                    message?: string;
                },
        ): this;
        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;
        min(
            minLength: number,
            params?:
                | string
                | {
                    abort?: boolean;
                    error?: string
                    | $ZodErrorMap<$ZodIssueTooSmall<HasLength>>;
                    message?: string;
                },
        ): this;
        nonempty(
            params?:
                | string
                | {
                    abort?: boolean;
                    error?: string
                    | $ZodErrorMap<$ZodIssueTooSmall<HasLength>>;
                    message?: string;
                },
        ): this;
        nonoptional(
            params?:
                | string
                | {
                    error?: string
                    | $ZodErrorMap<$ZodIssueInvalidType<unknown>>;
                    message?: string;
                },
        ): ZodNonOptional<_ZodString<T>>;
        normalize(form?: string & {} | "NFC" | "NFD" | "NFKC" | "NFKD"): this;
        nullable(): ZodNullable<_ZodString<T>>;
        nullish(): ZodOptional<ZodNullable<_ZodString<T>>>;
        optional(): ZodOptional<_ZodString<T>>;
        or<T extends SomeType>(option: T): ZodUnion<[_ZodString<T>, T]>;
        overwrite(fn: (x: output<_ZodString<T>>) => output<_ZodString<T>>): this;
        parse(
            data: unknown,
            params?: ParseContext<$ZodIssue>,
        ): output<_ZodString<T>>;
        parseAsync(
            data: unknown,
            params?: ParseContext<$ZodIssue>,
        ): Promise<output<_ZodString<T>>>;
        pipe<
            T extends
                $ZodType<
                    any,
                    output<_ZodString<T>>,
                    $ZodTypeInternals<any, output<_ZodString<T>>>,
                >,
        >(
            target:
                | T
                | $ZodType<
                    any,
                    output<_ZodString<T>>,
                    $ZodTypeInternals<any, output<_ZodString<T>>>,
                >,
        ): ZodPipe<_ZodString<T>, T>;
        prefault(def: () => input<_ZodString<T>>): ZodPrefault<_ZodString<T>>;
        prefault(def: input<_ZodString<T>>): ZodPrefault<_ZodString<T>>;
        readonly(): ZodReadonly<_ZodString<T>>;
        refine(
            check: (arg: output<_ZodString<T>>) => unknown,
            params?:
                | string
                | {
                    abort?: boolean;
                    error?: string
                    | $ZodErrorMap<NonNullable<$ZodIssue>>;
                    message?: string;
                    params?: Record<string, any>;
                    path?: PropertyKey[];
                },
        ): this;
        regex(
            regex: RegExp,
            params?:
                | string
                | {
                    abort?: boolean;
                    error?: string
                    | $ZodErrorMap<$ZodIssueInvalidStringFormat>;
                    message?: string;
                },
        ): this;
        register<
            R extends
                $ZodRegistry<
                    MetadataType,
                    $ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>>,
                >,
        >(
            registry: R,
            ...meta: _ZodString<T> extends R["_schema"]
                ? undefined extends R["_meta"]
                    ? [$replace<R["_meta"], R["_schema"] & _ZodString<T>>?]
                    : [$replace<R["_meta"], R["_schema"] & _ZodString<T>>]
                : ["Incompatible schema"],
        ): this;
        safeParse(
            data: unknown,
            params?: ParseContext<$ZodIssue>,
        ): ZodSafeParseResult<output<_ZodString<T>>>;
        safeParseAsync(
            data: unknown,
            params?: ParseContext<$ZodIssue>,
        ): Promise<ZodSafeParseResult<output<_ZodString<T>>>>;
        startsWith(
            value: string,
            params?:
                | string
                | {
                    abort?: boolean;
                    error?: string
                    | $ZodErrorMap<$ZodIssueInvalidStringFormat>;
                    message?: string;
                },
        ): this;
        superRefine(
            refinement: (
                arg: output<_ZodString<T>>,
                ctx: RefinementCtx<output<_ZodString<T>>>,
            ) => void | Promise<void>,
        ): this;
        toLowerCase(): this;
        toUpperCase(): this;
        transform<NewOut>(
            transform: (
                arg: output<_ZodString<T>>,
                ctx: RefinementCtx<output<_ZodString<T>>>,
            ) => NewOut | Promise<NewOut>,
        ): ZodPipe<
            _ZodString<T>,
            ZodTransform<Awaited<NewOut>, output<_ZodString<T>>>,
        >;
        trim(): this;
        uppercase(
            params?:
                | string
                | {
                    abort?: boolean;
                    error?: string
                    | $ZodErrorMap<$ZodIssueInvalidStringFormat>;
                    message?: string;
                    pattern?: RegExp;
                },
        ): this;
    }

    Type Parameters

    Hierarchy (View Summary)

    Index

    Properties

    _def: T["def"]

    Use .def instead.

    _input: T["input"]

    Use z.input<typeof schema> instead.

    _output: T["output"]

    Use z.output<typeof schema> instead.

    _zod: T
    def: T["def"]
    description?: string
    format: null | string
    maxLength: null | number
    minLength: null | number
    spa: (
        data: unknown,
        params?: ParseContext<$ZodIssue>,
    ) => Promise<ZodSafeParseResult<output<_ZodString<T>>>>
    type: T["def"]["type"]

    Methods

    • Parameters

      • Optionaldef: T["def"]
      • Optionalparams: { parent: boolean }

      Returns this

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

      Parameters

      • description: string

      Returns this

    • Parameters

      Returns this

    • Parameters

      • value: string
      • Optionalparams: {
            abort?: boolean;
            error?: string | $ZodErrorMap<$ZodIssueInvalidStringFormat>;
            message?: string;
            position?: number;
        }
        • Optionalabort?: boolean

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

        • Optionalerror?: string | $ZodErrorMap<$ZodIssueInvalidStringFormat>
        • Optionalmessage?: string

          This parameter is deprecated. Use error instead.

        • Optionalposition?: number

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

      Returns this

    • Parameters

      • Optionalparams:
            | string
            | {
                abort?: boolean;
                error?: string
                | $ZodErrorMap<$ZodIssueInvalidStringFormat>;
                message?: string;
                pattern?: RegExp;
            }
        • string
        • {
              abort?: boolean;
              error?: string | $ZodErrorMap<$ZodIssueInvalidStringFormat>;
              message?: string;
              pattern?: RegExp;
          }
          • Optionalabort?: boolean

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

          • Optionalerror?: string | $ZodErrorMap<$ZodIssueInvalidStringFormat>
          • Optionalmessage?: string

            This parameter is deprecated. Use error instead.

          • Optionalpattern?: RegExp

      Returns this

    • Parameters

      • maxLength: number
      • Optionalparams:
            | string
            | {
                abort?: boolean;
                error?: string
                | $ZodErrorMap<$ZodIssueTooBig<HasLength>>;
                message?: string;
            }
        • string
        • {
              abort?: boolean;
              error?: string | $ZodErrorMap<$ZodIssueTooBig<HasLength>>;
              message?: string;
          }
          • Optionalabort?: boolean

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

          • Optionalerror?: string | $ZodErrorMap<$ZodIssueTooBig<HasLength>>
          • Optionalmessage?: string

            This parameter is deprecated. Use error instead.

      Returns this

    • 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

      • minLength: number
      • Optionalparams:
            | string
            | {
                abort?: boolean;
                error?: string
                | $ZodErrorMap<$ZodIssueTooSmall<HasLength>>;
                message?: string;
            }

      Returns this

    • Parameters

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

      Returns this

    • Parameters

      • Optionalform: string & {} | "NFC" | "NFD" | "NFKC" | "NFKD"

      Returns this

    • Parameters

      • check: (arg: output<_ZodString<T>>) => 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

    • Parameters

      Returns this

    • Type Parameters

      Parameters

      Returns this

    • Parameters

      Returns this

    • Returns this

    • Returns this

    • Returns this

    • Parameters

      • Optionalparams:
            | string
            | {
                abort?: boolean;
                error?: string
                | $ZodErrorMap<$ZodIssueInvalidStringFormat>;
                message?: string;
                pattern?: RegExp;
            }
        • string
        • {
              abort?: boolean;
              error?: string | $ZodErrorMap<$ZodIssueInvalidStringFormat>;
              message?: string;
              pattern?: RegExp;
          }
          • Optionalabort?: boolean

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

          • Optionalerror?: string | $ZodErrorMap<$ZodIssueInvalidStringFormat>
          • Optionalmessage?: string

            This parameter is deprecated. Use error instead.

          • Optionalpattern?: RegExp

      Returns this