@lynxts/core • Docs
@lynxts/core / Adapter
Validation adapter for a T
structure. Specifies functions required for the
form validations and their hooks.
• T extends Struct
struct type of the form values
required: (
path
) =>boolean
• path: Path
<T
>
the path to check if it's requried
boolean
wether a path is required or not
validate: (
values
) =>Promise
<Result
<T
,Map
<Path
<T
>,string
>>>
• values: Partial
<T
>
the form values to validate
Promise
<Result
<T
, Map
<Path
<T
>, string
>>>
a promise with the Result<S, E>
of the validation
validateAt: <
K
>(path
,value
) =>Promise
<Result
<true
,string
>>
• K extends string
• path: K
the path on the schema to validate
• value: Optional
<ValueByPath
<T
, K
>>
the value to validate against
Promise
<Result
<true
, string
>>
a promise with the Result<S, E>
of the validation