Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infer type of ZodEffects schemas using zx.parseFormSafe #18

Merged
merged 2 commits into from Nov 14, 2022

Conversation

mdoury
Copy link
Contributor

@mdoury mdoury commented Nov 13, 2022

zx.parseFormSafe is able to parse ZodEffects schemas but it fails to infer the types.
I added a failing test to reproduce issue #17 but I wasn't able to fix it instantly so I will leave it there for now.
I will look into it next week probably.

@rileytomasek I did not dig into zod typings so far, do you have any idea how to handle this?

EDIT: I found a way to fix the type inference of result.error when user is parsing a ZodEffects schema with zx.parsFormSafe.

Fixes #17

@mdoury mdoury changed the title Infer type of ZodEffect schemas using zx.parseFormSafe Infer type of ZodEffects schemas using zx.parseFormSafe Nov 13, 2022
@rileytomasek
Copy link
Owner

Another good catch. Thanks for adding the additional test.

@rileytomasek rileytomasek merged commit ec3b803 into rileytomasek:master Nov 14, 2022
@mdoury mdoury deleted the #17 branch November 14, 2022 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

zx.parseFormSafe type inference does not handle ZodEffects
2 participants