-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
zod doesn't work with typescript 4.3.2
#473
Comments
Ran into the same issue today when updating packages. Keeping typescript at 4.2.4 works for now as a workaround. |
4.3.2
Thank you for filing this issue and giving a workaround which saved us some tzores. Can confirm that pinning TS to 4.2.3 solved our problem. For anyone Googling, this is the error we got:
|
workaround in my monorepo: trpc/trpc@ff184a9 |
I also experienced the same issue. Reverting to TS v4.2.4 solved it for now.
Ps. Love the library, keep up the awesome work! |
Hi guys. This has been raised on microsoft/TypeScript#44299. There seems to be a more severe variation of this where node runs out of memory during type checking when zod is in use. |
zod is incompatible with Typescript 4.3.x due a change in 4.3 for evaluating deep complex types. Since we do not use any 4.3 features (yet), lock typescript package to 4.2 until this is fixed see microsoft/TypeScript#43249, colinhacks/zod#443, colinhacks/zod#473, microsoft/TypeScript#44299
4.3.2
4.3.2
Fixed in zod@3.2 - upgrade and it will work with TypeScript 4.3.2. This was a doozy. TS 4.3 added limitations on the self-referential recursive conditional types inside class methods, something that Zod relies on heavily. I managed to get everything working again with minimal disruption to the Zod's internals, but there's one minor change that was unavoidable. Certain methods ( z.union([z.string(), z.number()]).or(z.boolean());
// previously
// => ZodUnion<[ZodString, ZodNumber, ZodBoolean]>
// now
// => ZodUnion<[ZodUnion<[ZodString, ZodNumber]>, ZodBoolean]> With TypeScript 4.3.2 it was no longer possible to reflect the old type signature. In practice I think this change is minor and could almost be considered an internal change so I'm not bumping the major version. This behavior is actually more consistent and avoids certain pitfalls when implementing generic functions that operate on ZodSchemas, so it's not all bad. |
Mainly for this: colinhacks/zod#473. We're not using TS 4.2.3 yet, but latest VS Code uses it by default and causes issues.
Mainly for this: colinhacks/zod#473. We're not using TS 4.2.3 yet, but latest VS Code uses it by default and causes issues.
Mainly for this: colinhacks/zod#473. We're not using TS 4.2.3 yet, but latest VS Code uses it by default and causes issues.
The version-pin workaround for colinhacks/zod#473 is no longer necessary. Also upgraded yarn packages in general.
see #472
The text was updated successfully, but these errors were encountered: