TheEdoRan / next-safe-action

Type safe and validated Server Actions in your Next.js (App Router) project.

Home Page:https://next-safe-action.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is it possible to get correct validation errors type back from an action defining schema with `zod-form-data`?

ervasive opened this issue · comments

Currently we get Partial<Record<"_root", string[]>> out of an action defining schema with zod-form-data instead of the actual fields that were specified, which is cumbersome to use.

Example:

zfd.formData({
    id: zfd.text(z.string().uuid()),
    name: zfd.text(z.string().min(8).max(100)),
    is_public: zfd.checkbox(),
})

Is there a way to get the correct type out of an action with zfd schema?

Cheers

Should be fixed in 5.2.2. Please let me know!

Works flawlessly. Thank you for the great library.