File tree Expand file tree Collapse file tree 5 files changed +19
-7
lines changed
test/src/pages/field_array_res Expand file tree Collapse file tree 5 files changed +19
-7
lines changed Original file line number Diff line number Diff line change 1- # v0.0.4 (unreleased)
1+ # v0.0.4
2+
3+ - Change type signature of append in useFieldArray hook
4+ - Updated from ` t => unit ` to ` defaultValuesOfT => unit `
5+ - This change provides better type flexibility when appending new items to the array
26
37# v0.0.3
48
Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ module ControllerOfInputs = {
9090// useFieldArray
9191type rec useFieldArrayReturnOfInputsCart = {
9292 fields: array<itemWithId>,
93- append: item => unit,
93+ append: defaultValuesOfItem => unit,
9494 remove: int => unit,
9595}
9696and useFieldArrayParamsOfInputsCart = {
Original file line number Diff line number Diff line change @@ -602,7 +602,7 @@ let map_type_decl
602602 [
603603 (* type useFieldArrayReturnOfInputsCart = {
604604 fields: array<itemWithId>,
605- append: item => unit,
605+ append: defaultValuesOfItem => unit,
606606 remove: int => unit,
607607 } *)
608608 Type. mk
@@ -628,7 +628,11 @@ let map_type_decl
628628 (uncurried_core_type_arrow ~arity: 1
629629 [
630630 Typ. arrow Nolabel
631- (Typ. constr (lid item_name) [] )
631+ (Typ. constr
632+ (lid
633+ (" defaultValuesOf"
634+ ^ capitalize item_name))
635+ [] )
632636 (Typ. constr (lid " unit" ) [] );
633637 ]);
634638 Type. field ~mut: Immutable
Original file line number Diff line number Diff line change @@ -602,7 +602,7 @@ let map_type_decl
602602 [
603603 (* type useFieldArrayReturnOfInputsCart = {
604604 fields: array<itemWithId>,
605- append: item => unit,
605+ append: defaultValuesOfItem => unit,
606606 remove: int => unit,
607607 } *)
608608 Type. mk
@@ -628,7 +628,11 @@ let map_type_decl
628628 (uncurried_core_type_arrow ~arity: 1
629629 [
630630 Typ. arrow Nolabel
631- (Typ. constr (lid item_name) [] )
631+ (Typ. constr
632+ (lid
633+ (" defaultValuesOf"
634+ ^ capitalize item_name))
635+ [] )
632636 (Typ. constr (lid " unit" ) [] );
633637 ]);
634638 Type. field ~mut: Immutable
Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ let default = () => {
5050 </div >
5151 })
5252 -> React .array }
53- <button type_ = "button" onClick = {_ => append ({name : "ppx" , quantity : 1 ., price : 1 .})}>
53+ <button type_ = "button" onClick = {_ => append ({quantity : 1 ., price : 1 .})}>
5454 {"APPEND" -> React .string }
5555 </button >
5656 <input type_ = "submit" />
You can’t perform that action at this time.
0 commit comments