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

Bug: z.void() schema output #37

Open
jlalmes opened this issue Jan 2, 2023 · 1 comment
Open

Bug: z.void() schema output #37

jlalmes opened this issue Jan 2, 2023 · 1 comment
Labels
Breaking solution This is a bug, but the solution to it would be a bigger problem than the original issue. V4

Comments

@jlalmes
Copy link

jlalmes commented Jan 2, 2023

I've just upgraded from v3.18 to v3.20 and noticed that the schema returned from z.void() is now {} instead of undefined. I've looked through the changelog and not seen this mentioned (therefore assume it's a bug?).

Reproduction: https://stackblitz.com/edit/typescript-6vgab1?devToolsHeight=33&file=index.ts

Thanks 🙌

@StefanTerdell
Copy link
Owner

Hey @jlalmes, thanks for the issue report. The PR above should fix your issue, but I'm hesitant to merge it due to it being a breaking change; while it's true that 3.18 returned undefined, 3.19 did not, and the main return type has never reflected the possibility of returning undefined.

These unresolvable types have always been a bit of a thorn in my side with this package and I've never been able to come up with a unified one-size-fits-all solution. I don't think this is it either and will be closing the PR for now, but I'm keeping the issue open to promote discussion.

@StefanTerdell StefanTerdell added the Breaking solution This is a bug, but the solution to it would be a bigger problem than the original issue. label Jan 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Breaking solution This is a bug, but the solution to it would be a bigger problem than the original issue. V4
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants