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