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

[Pg] Fix Zod Schema Generation for Array Items #1671

Open
wants to merge 1 commit into
base: beta
Choose a base branch
from

Conversation

dhing1024
Copy link

Not 100% sure, but I think this may solve #1609 and #1110

It seems like the bug might only be affecting the type inference and isn't a runtime bug. In a personal project I was able to remove the error by using // @ts-ignore to silence the warning, and it seemed to work normally.

In src/index.ts, this line is inferred as true for some reason: Equal<TColumn['enumValues'], [string, ...string[]]> extends true, so this could also be due to some other unrelated upstream issue. I fixed this by moving the type check TDataType extends 'array' check to be further up in the chain.

Reordered ternary conditions in GetZodType in src/index.ts. Added array varchars to pg.test.ts
@Joshuabaker2
Copy link

Excited for this to land! @nenya1840 is there something else needed before this gets merged into main?

@nenya1840
Copy link

Excited for this to land! @nenya1840 is there something else needed before this gets merged into main?

I don't have the write access

@Joshuabaker2
Copy link

Ah gotcha, maybe @AndriiSherman could help us?

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

4 participants