@@ -12,7 +12,7 @@ import { getConstraints } from '@conform-to/zod/v3/future';
1212import type { TextField , Checkbox , RadioGroup , Switch } from '@mui/material' ;
1313import type { Autocomplete , Rating , Slider } from './form' ;
1414
15- const result = configureForms ( {
15+ const forms = configureForms ( {
1616 getConstraints,
1717 shouldValidate : 'onBlur' ,
1818 shouldRevalidate : 'onInput' ,
@@ -70,36 +70,21 @@ const result = configureForms({
7070 } ,
7171} ) ;
7272
73- export type FormMetadata <
74- ErrorShape extends InferBaseErrorShape <
75- typeof result . config
76- > = InferBaseErrorShape < typeof result . config > ,
77- > = BaseFormMetadata <
78- ErrorShape ,
79- InferCustomFormMetadata < typeof result . config > ,
80- InferCustomFieldMetadata < typeof result . config >
81- > ;
73+ type BaseErrorShape = InferBaseErrorShape < typeof forms . config > ;
74+ type CustomFormMetadata = InferCustomFormMetadata < typeof forms . config > ;
75+ type CustomFieldMetadata = InferCustomFieldMetadata < typeof forms . config > ;
76+
77+ export type FormMetadata < ErrorShape extends BaseErrorShape = BaseErrorShape > =
78+ BaseFormMetadata < ErrorShape , CustomFormMetadata , CustomFieldMetadata > ;
8279
8380export type FieldMetadata <
8481 FieldShape ,
85- ErrorShape extends InferBaseErrorShape <
86- typeof result . config
87- > = InferBaseErrorShape < typeof result . config > ,
88- > = BaseFieldMetadata <
89- FieldShape ,
90- ErrorShape ,
91- InferCustomFieldMetadata < typeof result . config >
92- > ;
82+ ErrorShape extends BaseErrorShape = BaseErrorShape ,
83+ > = BaseFieldMetadata < FieldShape , ErrorShape , CustomFieldMetadata > ;
9384
9485export type Fieldset <
9586 FieldShape ,
96- ErrorShape extends InferBaseErrorShape <
97- typeof result . config
98- > = InferBaseErrorShape < typeof result . config > ,
99- > = BaseFieldset <
100- FieldShape ,
101- ErrorShape ,
102- InferCustomFieldMetadata < typeof result . config >
103- > ;
87+ ErrorShape extends BaseErrorShape = BaseErrorShape ,
88+ > = BaseFieldset < FieldShape , ErrorShape , CustomFieldMetadata > ;
10489
105- export const useForm = result . useForm ;
90+ export const useForm = forms . useForm ;
0 commit comments