useTransition typescript error

I have a server action that looks like this:
export async function deleteTask(id: string) {
await prisma.task.delete({
where: {
id,
},
});

revalidatePath("/projects/tasks");
}
export async function deleteTask(id: string) {
await prisma.task.delete({
where: {
id,
},
});

revalidatePath("/projects/tasks");
}
I am importing this in a client component and calling it using the useTransition hook like this:
<DropdownMenuItem onClick={() => startTransition(() => deleteTask(task.id))}>Edit</DropdownMenuItem>
<DropdownMenuItem onClick={() => startTransition(() => deleteTask(task.id))}>Edit</DropdownMenuItem>
However im getting this ts error: Type 'Promise<void>' is not assignable to type 'VoidOrUndefinedOnly'
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server