r/reactjs • • Oct 24 '26

Needs Help Please help me understand Zod schema transformations

/r/learnprogramming/comments/1xdp1j2/please_help_me_understand_zod_schema/
7 Upvotes

7 comments sorted by

4

u/SoftwareNegative8783 Oct 24 '26

Your second line parses `task.data`, which is already the output. So it runs through `taskSchema` again, `dueDate` is missing, and `deadline` becomes undefined. Parse the raw input instead.

1

u/ToshiryuShadow Oct 24 '26

Wow, thanks a lot! Lesson learned!

1

u/[deleted] Oct 24 '26

[removed] — view removed comment

1

u/ToshiryuShadow Oct 24 '26

Thanks a lot! After reading all of the answers I understood what the problem was.