File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed
Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,8 @@ import {
2222 unsetDirty ,
2323 unsetTouched ,
2424 validate ,
25+ getFieldError ,
26+ getFieldErrors ,
2527} from '../methods' ;
2628
2729export type CreateFormOptions < V extends FormValue > = {
@@ -54,6 +56,8 @@ export function createForm<V extends FormValue>(
5456 get value ( ) {
5557 return formValue ( ) ;
5658 } ,
59+ getFieldError : ( ...args ) => getFieldError ( formState , ...args ) ,
60+ getFieldErrors : ( ...args ) => getFieldErrors ( formState , ...args ) ,
5761 getFieldValue : ( ...args ) => getFieldValue ( formState , ...args ) ,
5862 isDirty : ( ...args ) => isDirty ( formState , ...args ) ,
5963 isFieldDirty : ( ...args ) => isFieldDirty ( formState , ...args ) ,
Original file line number Diff line number Diff line change @@ -14,12 +14,14 @@ import type { CreateFormOptions } from '../primitives';
1414
1515export interface FormState < V extends FormValue > {
1616 value : V ;
17+ getFieldError < P extends FieldPath < V > > ( fieldPath : P ) : string | null ;
18+ getFieldErrors < P extends FieldPath < V > > ( fieldPath : P ) : string [ ] ;
1719 getFieldValue < P extends FieldPath < V > > ( fieldPath : P ) : FieldValue < V , P > ;
1820 isDirty ( ) : boolean ;
1921 isFieldDirty < P extends FieldPath < V > > ( fieldPath : P ) : boolean ;
22+ hasError ( ) : boolean ;
2023 hasFieldError < P extends FieldPath < V > > ( fieldPath : P ) : boolean ;
2124 isFieldTouched < P extends FieldPath < V > > ( fieldPath : P ) : boolean ;
22- hasError ( ) : boolean ;
2325 isTouched ( ) : boolean ;
2426 setFieldDirty < P extends FieldPath < V > > (
2527 fieldPath : P ,
You can’t perform that action at this time.
0 commit comments