diff --git a/src/hooks/useFormState/useFormState.ts b/src/hooks/useFormState/useFormState.ts index d2a4260..64e6fe7 100644 --- a/src/hooks/useFormState/useFormState.ts +++ b/src/hooks/useFormState/useFormState.ts @@ -12,7 +12,7 @@ export interface IFormField { isTouched: boolean; setIsTouched: (isTouched: boolean) => void; reset: () => void; - schema: yup.SchemaOf; + schema: yup.AnySchema; } export interface IValidatedFormField extends IFormField { @@ -52,7 +52,7 @@ export interface IFormState { export const useFormField = ( initialValue: T, - schema: yup.SchemaOf, + schema: yup.AnySchema, options: { initialTouched?: boolean } = {} ): IFormField => { const [initializedValue, setInitializedValue] = React.useState(initialValue); @@ -109,7 +109,7 @@ export const useFormState = ( lastValuesRef.current = values; const schemaShape = fieldKeys.reduce( (newObj, key) => ({ ...newObj, [key]: fields[key].schema }), - {} as { [key in keyof TFieldValues]: yup.SchemaOf } + {} as { [key in keyof TFieldValues]: yup.AnySchema } ); const schema = yup.object().shape(schemaShape); setHasRunInitialValidation(true);