UNPKG

next-safe-action

Version:

Type safe and validated Server Actions in your Next.js project.

30 lines (27 loc) 631 B
import { z } from "zod"; import { ValidationAdapter, IfInstalled, Infer } from "./types.mjs"; import "@sinclair/typebox"; import "valibot"; import "yup"; declare class ZodAdapter implements ValidationAdapter { validate<S extends IfInstalled<z.ZodType>>( schema: S, data: unknown ): Promise< | { readonly success: true; readonly data: Infer<S>; readonly issues?: undefined; } | { readonly success: false; readonly issues: { message: string; path: (string | number)[]; }[]; readonly data?: undefined; } >; } declare function zodAdapter(): ZodAdapter; export { zodAdapter };