You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
const{ control }=useFormContext<ChallengesFormValues>();const{fields: checklist,
append,
replace,
remove,}=useFieldArray<ChallengesFormValues>({name: `confirmList.${index}.checklist`,
control,});
This is my code.
Here, if you delete the ChallengesFormValues type in useFieldArray, the types of fields can be inferred well, but when passing props to the component below, the items type of ConfirmCheckList is inferred as never type.
<ConfirmCheckListcontrol={control}prefixName={`confirmList.${index}.checklist`}// This is never[] typeitems={checklist}onChangeOrder={(items)=>{replace(items);}}onDelete={(index)=>{remove(index);}}/>typeProps<TextendsFieldValues>={control: Control<T>;prefixName: Path<T>;items: FieldArrayWithId<T,FieldArrayPath<T>,'id'>[];onChangeOrder: (items: FieldArrayWithId<T,ArrayPath<T>,'id'>[])=>void;onDelete: (index: number)=>void;};functionConfirmCheckList<TextendsFieldValues>({
control,
prefixName,
items,
onChangeOrder,
onDelete,}: Props<T>)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
This is my code.
Here, if you delete the ChallengesFormValues type in useFieldArray, the types of fields can be inferred well, but when passing props to the component below, the items type of ConfirmCheckList is inferred as never type.
Beta Was this translation helpful? Give feedback.
All reactions