zod
Version:
Typescript-first schema declaration and validation library with static type inference
33 lines (32 loc) • 2.54 kB
TypeScript
import { ZodString, ZodStringDef } from './types/string';
import { ZodNumber, ZodNumberDef } from './types/number';
import { ZodBoolean, ZodBooleanDef } from './types/boolean';
import { ZodUndefined, ZodUndefinedDef } from './types/undefined';
import { ZodNull, ZodNullDef } from './types/null';
import { ZodArray, ZodArrayDef } from './types/array';
import { ZodObject, ZodObjectDef } from './types/object';
import { ZodUnion, ZodUnionDef } from './types/union';
import { ZodIntersection, ZodIntersectionDef } from './types/intersection';
import { ZodTuple, ZodTupleDef } from './types/tuple';
import { ZodFunction, ZodFunctionDef } from './types/function';
import { ZodLazy, ZodLazyDef } from './types/lazy';
import { TypeOf, ZodType, ZodAny } from './types/base';
export declare type ZodDef = ZodStringDef | ZodNumberDef | ZodBooleanDef | ZodUndefinedDef | ZodNullDef | ZodArrayDef | ZodObjectDef | ZodUnionDef | ZodIntersectionDef | ZodTupleDef | ZodFunctionDef | ZodLazyDef;
declare const stringType: () => ZodString;
declare const numberType: () => ZodNumber;
declare const booleanType: () => ZodBoolean;
declare const undefinedType: () => ZodUndefined;
declare const nullType: () => ZodNull;
declare const arrayType: <T extends ZodAny>(schema: T) => ZodArray<T>;
declare const objectType: <T extends import("./types/base").ZodRawShape>(shape: T) => ZodObject<T>;
declare const unionType: <T extends [ZodAny, ZodAny, ...ZodAny[]]>(types: T) => ZodUnion<T>;
declare const intersectionType: <T extends ZodAny, U extends ZodAny>(left: T, right: U) => ZodIntersection<T, U>;
declare const tupleType: <T extends [] | [ZodAny, ...ZodAny[]]>(schemas: T) => ZodTuple<T>;
declare const functionType: <T extends ZodTuple<any>, U extends ZodAny>(args: T, returns: U) => ZodFunction<T, U>;
declare const lazyType: <T extends ZodAny>(getter: () => T) => ZodLazy<T>;
declare const ostring: () => ZodUnion<[ZodString, ZodUndefined]>;
declare const onumber: () => ZodUnion<[ZodNumber, ZodUndefined]>;
declare const oboolean: () => ZodUnion<[ZodBoolean, ZodUndefined]>;
export { stringType as string, numberType as number, booleanType as boolean, undefinedType as undefined, nullType, arrayType as array, objectType as object, unionType as union, intersectionType as intersection, tupleType as tuple, functionType, lazyType as lazy, ostring, onumber, oboolean, };
export { ZodString, ZodNumber, ZodBoolean, ZodUndefined, ZodNull, ZodArray, ZodObject, ZodUnion, ZodIntersection, ZodTuple, ZodFunction, ZodLazy, ZodType, ZodAny, };
export { TypeOf };