compat.d.ts 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import * as core from "../core/index.js";
  2. import type { ZodType } from "./schemas.js";
  3. export type {
  4. /** @deprecated Use `z.output<T>` instead. */
  5. output as TypeOf,
  6. /** @deprecated Use `z.output<T>` instead. */
  7. output as Infer,
  8. /** @deprecated Use `z.core.$$ZodFirstPartyTypes` instead */
  9. $ZodTypes as ZodFirstPartySchemaTypes, } from "../core/index.js";
  10. /** @deprecated Use the raw string literal codes instead, e.g. "invalid_type". */
  11. export declare const ZodIssueCode: {
  12. readonly invalid_type: "invalid_type";
  13. readonly too_big: "too_big";
  14. readonly too_small: "too_small";
  15. readonly invalid_format: "invalid_format";
  16. readonly not_multiple_of: "not_multiple_of";
  17. readonly unrecognized_keys: "unrecognized_keys";
  18. readonly invalid_union: "invalid_union";
  19. readonly invalid_key: "invalid_key";
  20. readonly invalid_element: "invalid_element";
  21. readonly invalid_value: "invalid_value";
  22. readonly custom: "custom";
  23. };
  24. /** @deprecated Use `z.$ZodFlattenedError` */
  25. export type inferFlattenedErrors<T extends core.$ZodType, U = string> = core.$ZodFlattenedError<core.output<T>, U>;
  26. /** @deprecated Use `z.$ZodFormattedError` */
  27. export type inferFormattedError<T extends core.$ZodType<any, any>, U = string> = core.$ZodFormattedError<core.output<T>, U>;
  28. /** Use `z.$brand` instead */
  29. export type BRAND<T extends string | number | symbol = string | number | symbol> = {
  30. [core.$brand]: {
  31. [k in T]: true;
  32. };
  33. };
  34. export { $brand, config } from "../core/index.js";
  35. /** @deprecated Use `z.config(params)` instead. */
  36. export declare function setErrorMap(map: core.$ZodErrorMap): void;
  37. /** @deprecated Use `z.config()` instead. */
  38. export declare function getErrorMap(): core.$ZodErrorMap<core.$ZodIssue> | undefined;
  39. export type {
  40. /** @deprecated Use z.ZodType (without generics) instead. */
  41. ZodType as ZodTypeAny,
  42. /** @deprecated Use `z.ZodType` */
  43. ZodType as ZodSchema,
  44. /** @deprecated Use `z.ZodType` */
  45. ZodType as Schema, };
  46. /** Included for Zod 3 compatibility */
  47. export type ZodRawShape = core.$ZodShape;
  48. /** @deprecated Do not use. Stub definition, only included for zod-to-json-schema compatibility. */
  49. export declare enum ZodFirstPartyTypeKind {
  50. }