next-safe-action
Version:
Type safe and validated Server Actions in your Next.js project.
30 lines (27 loc) • 705 B
text/typescript
import { GenericSchema, GenericSchemaAsync } from "valibot";
import { ValidationAdapter, IfInstalled, Infer } from "./types.mjs";
import "@sinclair/typebox";
import "yup";
import "zod";
declare class ValibotAdapter implements ValidationAdapter {
validate<S extends IfInstalled<GenericSchema | GenericSchemaAsync>>(
schema: S,
data: unknown
): Promise<
| {
readonly success: true;
readonly data: Infer<S>;
readonly issues?: undefined;
}
| {
readonly success: false;
readonly issues: {
message: string;
path: string[] | undefined;
}[];
readonly data?: undefined;
}
>;
}
declare function valibotAdapter(): ValibotAdapter;
export { valibotAdapter };