Skip to main content
Module

x/zod/index.ts>ZodFunction

TypeScript-first schema validation with static type inference
Extremely Popular
Go to Latest
class ZodFunction
extends ZodType<OuterTypeOfFunction<Args, Returns>, ZodFunctionDef<Args, Returns>, InnerTypeOfFunction<Args, Returns>>
import { ZodFunction } from "https://deno.land/x/zod@v3.17.3/index.ts";

Type Parameters

Args extends ZodTuple<any, any>
Returns extends ZodTypeAny

Properties

validate

Methods

_parse(input: ParseInput): ParseReturnType<any>
args<Items extends Parameters<ZodTuple["create"]>[0]>(...items: Items): ZodFunction<ZodTuple<Items, ZodUnknown>, Returns>
implement<F extends InnerTypeOfFunction<Args, Returns>>(func: F): F
returns<NewReturnType extends ZodType<any, any>>(returnType: NewReturnType): ZodFunction<Args, NewReturnType>
strictImplement(func: InnerTypeOfFunction<Args, Returns>): InnerTypeOfFunction<Args, Returns>

Static Properties

create: <T extends ZodTuple<any, any> = ZodTuple<[], ZodUnknown>, U extends ZodTypeAny = ZodUnknown>(
args?: T,
returns?: U,
params?: RawCreateParams,
) => ZodFunction<T, U>