-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
v4: Typescript compilation error - TS2636 Type 'ZodObject<sub-Shape, Extra>' is not assignable to type 'ZodObject<super-Shape, Extra>' #4178
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
Comments
Update: Solved, I needed to use modules!in {
"type": "module",
} Working {
"extends": [
"@tsconfig/node23/tsconfig.json",
"@tsconfig/node-ts/tsconfig.json"
],
"compilerOptions": {
"noEmit": true,
"noImplicitReturns": false
}
} Also getting this error:
Dependencies:
If there's any more info I can provide I happily will! Here's a repo that replicates the error: https://github.com/radiosilence/zod4-error Trying a few different versions, |
There's additional issues if you don't have a global
|
Should be fixed in most circumstances in the latest betas. The |
Compiling v4 ( 4.0.0-beta.20250415T232143 ) with typescript v5.8.3 and "skipLibCheck": false produce the following typescript error:
error TS2636: Type 'ZodInterface<sub-Shape, Params>' is not assignable to type 'ZodInterface<super-Shape, Params>' as implied by variance annotation.
The text was updated successfully, but these errors were encountered: