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

TS2321: Excessive stack depth comparing types #27

Closed
BYohann opened this issue May 28, 2021 · 3 comments
Closed

TS2321: Excessive stack depth comparing types #27

BYohann opened this issue May 28, 2021 · 3 comments

Comments

@BYohann
Copy link

BYohann commented May 28, 2021

TS ERROR

zod : 3.10
ts-to-zod : 1.2.0
Typescript 4.3.2

this TS interface

export interface tag {
  tags: any[];
}

output

export const tagSchema = z.object({
  tags: z.array(z.any())
});

but produce a typescript error :

TS2321: Excessive stack depth comparing types 'ZodError?>' and 'ZodError?>'.
TS2321: Excessive stack depth comparing types 'ZodFormattedError?>' and 'ZodFormattedError?>'.
TS2321: Excessive stack depth comparing types 'ZodIntersection?, U>' and 'ZodIntersection?, U>'.
TS2321: Excessive stack depth comparing types 'ZodIntersection ' and 'ZodIntersection '.
TS2321: Excessive stack depth comparing types 'ZodNonEmptyArray?>' and 'ZodNonEmptyArray?>'.
@fabien0102
Copy link
Owner

🤔 Strange indeed, I will need to investigate a bit. Thanks for reporting this issue

As workaround, you can use the --skipValidation flag, the API is well tested 😉

@fabien0102
Copy link
Owner

This seams to be related to typescript version, 4.2.3 works perfectly (I will fix the version for now I think)

Related issues:
microsoft/TypeScript#43249
colinhacks/zod#443

@BYohann
Copy link
Author

BYohann commented May 28, 2021

I just tested it, works like a charm now, congrats and thank you

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

No branches or pull requests

2 participants