Skip to content

Commit

Permalink
fix(yup): fix ts error (#625)
Browse files Browse the repository at this point in the history
  • Loading branch information
kotarella1110 authored Aug 28, 2023
1 parent 94b2b84 commit 918d72f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions yup/src/yup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ const parseErrorSchema = (
};

export function yupResolver<TFieldValues extends FieldValues>(
schema: Yup.ObjectSchema<TFieldValues> | ReturnType<typeof Yup.lazy>,
schema:
| Yup.ObjectSchema<TFieldValues>
| ReturnType<typeof Yup.lazy<Yup.ObjectSchema<TFieldValues>>>,
schemaOptions: Parameters<(typeof schema)['validate']>[1] = {},
resolverOptions: {
/**
Expand All @@ -56,7 +58,7 @@ export function yupResolver<TFieldValues extends FieldValues>(
*/
raw?: boolean;
} = {},
): Resolver<TFieldValues> {
): Resolver<Yup.InferType<typeof schema>> {
return async (values, context, options) => {
try {
if (schemaOptions.context && process.env.NODE_ENV === 'development') {
Expand Down

0 comments on commit 918d72f

Please sign in to comment.