-
Notifications
You must be signed in to change notification settings - Fork 9
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
Fix handling of schemas with .transform
in them
#32
Fix handling of schemas with .transform
in them
#32
Conversation
I added some suggestions here: netroy#1 |
? z.output<T> | ||
: never; | ||
|
||
export type input<T> = T extends new (...args: any[]) => infer R |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious, what was the reason to separate out into input/output?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The constructors argument should be of the type z.input<schema>
and the instance type of the class should be z.output<schema>
with z.input
being the type of what should go into z.parse
and z.output
is the type it returns if parsed successfully which includes all transforms which can change the type.
I could try to parameterize this type and have z.input
and z.output
passed in as a type parameter to reduce the duplication. Should I give that a try?
I hope I got the question right, if not let me know :)
Thanks @netroy and @despairblue, the fix is released in |
Fixes #31