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

Do not expliclity type generated schemas #64

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hco
Copy link

@hco hco commented Dec 23, 2022

Typing them explicitly with ZodType removes some features from the generated schemas.

For example, ZodType lacks features from ZodObject such as .pick, or .merge.

Others have stumbled upon this issue as well, for example, #24 and #25 bring this up. In #25 (comment) someone brings up that the change I made broke something in the generator for them.
In my case, nothing broke - but this could of course have unwanted side effects. In my understanding, ZodObject extends ZodType, which reduces the risk of issues.

But I am really not sure about this.

This removes some features from the generated schemas.

For example, `ZodType` lacks features from `ZodObject` such as `.pick`, or `.merge`.
@omar-dulaimi
Copy link
Owner

Indeed, some things got broken. If you try the generated schemas with tRPC, you would face this error(among others):

'PostFindManySchema' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.

So, until we found a solution for that problem, we can't really merge this PR sadly

@omar-dulaimi omar-dulaimi marked this pull request as draft May 19, 2023 12:11
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.

None yet

2 participants