Skip to content

Commit

Permalink
fix(types): add generic validate function for adapters
Browse files Browse the repository at this point in the history
  • Loading branch information
TheEdoRan committed Jul 19, 2024
1 parent fff996c commit 22fa774
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/next-safe-action/src/adapters/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ export type ValidationIssue = {
};

export interface ValidationAdapter {
// generic
validate<S extends Schema>(
schema: S,
data: unknown
): Promise<{ success: true; data: Infer<S> } | { success: false; issues: ValidationIssue[] }>;
// zod
validate<S extends z.ZodType>(
schema: S,
Expand Down

0 comments on commit 22fa774

Please sign in to comment.