Skip to content

Commit

Permalink
fix(types): add Lazy schema support to resolver (#135)
Browse files Browse the repository at this point in the history
- related to #92 & #31
  • Loading branch information
sukjae authored Feb 26, 2021
1 parent 132a90e commit ac2128e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/yup.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import { Resolver, transformToNestObject, FieldValues } from 'react-hook-form';
import Yup from 'yup';
import Lazy from 'yup/lib/Lazy';

/**
* From 0.32.0, Yup add TypeScript support and `path` typing is optional that's why we have `@ts-expect-error`
Expand Down Expand Up @@ -58,7 +59,7 @@ type ValidateOptions<T extends Yup.AnyObjectSchema> = Parameters<
>[1];

export const yupResolver = <TFieldValues extends FieldValues>(
schema: Yup.AnyObjectSchema,
schema: Yup.AnyObjectSchema | Lazy<any, any>,
options: ValidateOptions<Yup.AnyObjectSchema> = {
abortEarly: false,
},
Expand Down

0 comments on commit ac2128e

Please sign in to comment.