guys. I’m new to Typescript and I’m having trouble passing arguments to a function in Typescript. This function is called when I render a form modal.But I end up getting two errors:
“Argument of type ‘Promise<AxiosResponse>’ is not assignable to parameter of type ‘(data: Record<string, unknown>) => Promise’.”
“Type ‘Promise<AxiosResponse>’ provides no match for the signature ‘(data: Record<string, unknown>): Promise’.”
function openModal(activity) {
const data = ref({
name: activity.name,
})
formRender.render(activity, updateActivity(activity.id,{name:data.value.name}))
}
This would be the function:
export function updateActivity(id: number, data: Record<string, unknown>) {
return http.patch(`/${id}`, { name: data.name })
}