@@ -76,9 +76,8 @@ let map_type_decl
7676 ~kind:
7777 (Ptype_record
7878 [
79- Type. field
80- ~attrs: [ Attr. mk (mknoloc " res.optional" ) (PStr [] ) ]
81- ~mut: Immutable (mknoloc " message" )
79+ Type. field ~attrs: [ attr_optional ] ~mut: Immutable
80+ (mknoloc " message" )
8281 (Typ. constr (lid " string" ) [] );
8382 ]);
8483 (* @unboxed type watchReturnOfInputs = String(string) | Number(float) *)
@@ -209,9 +208,9 @@ let map_type_decl
209208 ^ capitalize record_name)
210209 [] ));
211210 ]);
212- (* setValue: (variantOfInputs, ReactHookForm.value) => unit, *)
211+ (* setValue: (variantOfInputs, ReactHookForm.value, ~options: setValueConfigOfInputs=? ) => unit, *)
213212 Type. field ~mut: Immutable (mknoloc " setValue" )
214- (uncurried_core_type_arrow ~arity: 2
213+ (uncurried_core_type_arrow ~arity: 3
215214 [
216215 Typ. arrow Nolabel
217216 (Typ. constr
@@ -223,7 +222,12 @@ let map_type_decl
223222 (Longident. Ldot
224223 (Lident " ReactHookForm" , " value" )))
225224 [] )
226- (Typ. constr (lid " unit" ) [] ));
225+ (Typ. arrow (Optional " options" )
226+ (Typ. constr
227+ (lid @@ " setValueConfigOf"
228+ ^ capitalize record_name)
229+ [] )
230+ (Typ. constr (lid " unit" ) [] )));
227231 ]);
228232 ]);
229233 (* type controlOfInputs *)
@@ -243,14 +247,11 @@ let map_type_decl
243247 ~kind:
244248 (Ptype_record
245249 [
246- Type. field
247- ~attrs: [ Attr. mk (mknoloc " res.optional" ) (PStr [] ) ]
248- ~mut: Immutable (mknoloc " required" )
250+ Type. field ~attrs: [ attr_optional ] ~mut: Immutable
251+ (mknoloc " required" )
249252 (Typ. constr (lid " bool" ) [] );
250- Type. field
251- ~attrs: [ Attr. mk (mknoloc " res.optional" ) (PStr [] ) ]
252- ~mut: Immutable (mknoloc " setValueAs" )
253- (Typ. var " setValueAs" );
253+ Type. field ~attrs: [ attr_optional ] ~mut: Immutable
254+ (mknoloc " setValueAs" ) (Typ. var " setValueAs" );
254255 ]);
255256 (* type formStateOfInputs = {isDirty: bool, isValid: bool, errors: fieldErrorsOfInputs} *)
256257 Type. mk
@@ -325,19 +326,15 @@ let map_type_decl
325326 ~kind:
326327 (Ptype_record
327328 [
328- Type. field
329- ~attrs: [ Attr. mk (mknoloc " res.optional" ) (PStr [] ) ]
330- ~mut: Immutable (mknoloc " resolver" )
331- (Typ. var " resolver" );
332- Type. field
333- ~attrs: [ Attr. mk (mknoloc " res.optional" ) (PStr [] ) ]
334- ~mut: Immutable (mknoloc " defaultValues" )
329+ Type. field ~attrs: [ attr_optional ] ~mut: Immutable
330+ (mknoloc " resolver" ) (Typ. var " resolver" );
331+ Type. field ~attrs: [ attr_optional ] ~mut: Immutable
332+ (mknoloc " defaultValues" )
335333 (Typ. constr
336334 (lid @@ " defaultValuesOf" ^ capitalize record_name)
337335 [] );
338- Type. field
339- ~attrs: [ Attr. mk (mknoloc " res.optional" ) (PStr [] ) ]
340- ~mut: Immutable (mknoloc " mode" )
336+ Type. field ~attrs: [ attr_optional ] ~mut: Immutable
337+ (mknoloc " mode" )
341338 (Typ. variant
342339 [
343340 Rf. tag (mknoloc " onBlur" ) true [];
@@ -348,6 +345,22 @@ let map_type_decl
348345 ]
349346 Closed None );
350347 ]);
348+ Type. mk
349+ (mkloc (" setValueConfigOf" ^ capitalize record_name) ptype_loc)
350+ ~priv: Public
351+ ~kind:
352+ (Ptype_record
353+ [
354+ Type. field ~attrs: [ attr_optional ] ~mut: Immutable
355+ (mknoloc " shouldValidate" )
356+ (Typ. constr (lid " bool" ) [] );
357+ Type. field ~attrs: [ attr_optional ] ~mut: Immutable
358+ (mknoloc " shouldDirty" )
359+ (Typ. constr (lid " bool" ) [] );
360+ Type. field ~attrs: [ attr_optional ] ~mut: Immutable
361+ (mknoloc " shouldTouch" )
362+ (Typ. constr (lid " bool" ) [] );
363+ ]);
351364 ]
352365 in
353366
0 commit comments