diff --git a/src/Field.tsx b/src/Field.tsx index cb28464..68e198b 100644 --- a/src/Field.tsx +++ b/src/Field.tsx @@ -39,7 +39,6 @@ export type FieldProps< , TShowErrors extends boolean = false , TLabel extends string | undefined = undefined , TFieldValue extends DeepValue = DeepValue - , TValidator extends SingleFieldValidator = SingleFieldValidator , TShouldValidate extends boolean = true > = ( TComponentProps extends undefined ? Omit, DuplicateProps> @@ -152,7 +151,7 @@ export type FieldProps< * validator={ zodAdapter( z.string().min(5), { isField: true } ) } * ``` */ - validator?: TShouldValidate extends false ? never : TValidator; + validator?: TShouldValidate extends false ? never : SingleFieldValidator; /** * Whether to run validation after field value is updated or the field is blurred. * Setting this prop to `false` will cancel any validation set for the field. @@ -220,7 +219,6 @@ export const Field = < , TShowErrors , TLabel , TFieldValue - , TValidator , TShouldValidate > ) => { diff --git a/src/createFormStore.ts b/src/createFormStore.ts index 3edd341..1bf5040 100644 --- a/src/createFormStore.ts +++ b/src/createFormStore.ts @@ -25,7 +25,7 @@ export type CreateFormStoreParams = { */ manualValidationHandler?: ValidationHandler>; /** - * A custom input for a validation schema from a third-party library + * A custom input for a validation schema from a third-party library. * Must be wrapped in a provided or a custom-built adapter */ validationSchema?: ValidationHandler>; diff --git a/src/types.ts b/src/types.ts index b20e062..360c832 100644 --- a/src/types.ts +++ b/src/types.ts @@ -74,7 +74,7 @@ export type ValidationHandler = export type SingleFieldValidator< TFormValues extends FormValues - , TFieldName extends DeepKeys = DeepKeys + , TFieldName extends DeepKeys > = ( value: DeepValue ) => Promise | string | Nullish; /** @@ -403,7 +403,6 @@ export type FieldComponent , TLabel extends string | undefined = undefined , TFieldValue extends DeepValue = DeepValue , TShouldValidate extends boolean = boolean - , TValidator extends SingleFieldValidator = SingleFieldValidator >( props: FieldProps< TFormValues @@ -412,7 +411,6 @@ export type FieldComponent , TShowErrors , TLabel , TFieldValue - , TValidator , TShouldValidate > ) => ReactNode;