From 573ae2eb6e4224186f32891c253f435313f8047a Mon Sep 17 00:00:00 2001 From: "@rahmatillo.djulmatov" Date: Thu, 9 Mar 2023 14:52:42 +0500 Subject: [PATCH] second arg of validator function typed --- src/types.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/types.ts b/src/types.ts index 3d810b0..0a453b6 100644 --- a/src/types.ts +++ b/src/types.ts @@ -9,9 +9,9 @@ export type ValidationResult = { errorText?: string } -export type Validator = ( +export type Validator = ( value: Value, - form?: Form, + form: Form, source?: Source, ) => boolean | ValidationResult @@ -21,7 +21,7 @@ export type ValidationError = { errorText?: string } -export type Rule = { +export type Rule = { name: string errorText?: string source?: Store @@ -66,9 +66,9 @@ export type RuleResolver< Form = any > = (value: Value, form: Form) => Rule[] -export type FieldConfig = { +export type FieldConfig = { init: Value | InitFieldValue - rules?: Rule[] | RuleResolver + rules?: Rule[] | RuleResolver filter?: Store | FilterFunc validateOn?: ValidationEvent[] units?: { @@ -91,7 +91,7 @@ export type AnyFields = { } export type AnyFieldsConfigs = { - [key: string]: FieldConfig + [key: string]: FieldConfig } export type AnyFormValues = { @@ -105,7 +105,7 @@ export type FormValues = { } export type FormFieldConfigs = { - [K in keyof Values]: FieldConfig + [K in keyof Values]: FieldConfig } export type FormFields = {