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

BUG: Doesn't work with Zod 3.24.x #294

Closed
itizarsa opened this issue Mar 10, 2025 · 2 comments
Closed

BUG: Doesn't work with Zod 3.24.x #294

itizarsa opened this issue Mar 10, 2025 · 2 comments

Comments

@itizarsa
Copy link

After updating to Zod v3.24.0, which implements @standard-schema/spec, I am encountering the below error

Argument of type 'typeof import("file:///Users/repro/$node_modules/.deno/[email protected]/$node_modules/zod/lib/external")' is not assignable to parameter of type 'typeof import("file:///Users/repro/$node_modules/.deno/[email protected]/$node_modules/zod/lib/external")'.
  Types of property 'setErrorMap' are incompatible.
    Type '(map: import("file:///Users/repro/$node_modules/.deno/[email protected]/$node_modules/zod/lib/ZodError").ZodErrorMap) => void' is not assignable to type '(map: Zod.ZodErrorMap) => void'.
      Types of parameters 'map' and 'map' are incompatible.
        Types of parameters 'issue' and 'issue' are incompatible.
          Type 'import("file:///Users/repro/$node_modules/.deno/[email protected]/$node_modules/zod/lib/ZodError").ZodIssueOptionalMessage' is not assignable to type 'Zod.ZodIssueOptionalMessage'.
            Type 'ZodInvalidUnionIssue' is not assignable to type 'ZodIssueOptionalMessage'.
              Type 'import("file:///Users/repro/$node_modules/.deno/[email protected]/$node_modules/zod/lib/ZodError").ZodInvalidUnionIssue' is not assignable to type 'Zod.ZodInvalidUnionIssue'.
                Types of property 'unionErrors' are incompatible.
                  Type 'import("file:///Users/repro/$node_modules/.deno/[email protected]/$node_modules/zod/lib/ZodError").ZodError<any>[]' is not assignable to type 'Zod.ZodError<any>[]'.
                    Type 'import("file:///Users/repro/$node_modules/.deno/[email protected]/$node_modules/zod/lib/ZodError").ZodError<any>' is not assignable to type 'Zod.ZodError<any>'.
                      Types of property 'issues' are incompatible.
                        Type 'import("file:///Users/repro/$node_modules/.deno/[email protected]/$node_modules/zod/lib/ZodError").ZodIssue[]' is not assignable to type 'Zod.ZodIssue[]'.
                          Type 'import("file:///Users/repro/$node_modules/.deno/[email protected]/$node_modules/zod/lib/ZodError").ZodIssue' is not assignable to type 'Zod.ZodIssue'.
                            Type 'ZodInvalidUnionIssue & { fatal?: boolean | undefined; message: string; }' is not assignable to type 'ZodIssue'.
                              Type 'import("file:///Users/repro/$node_modules/.deno/[email protected]/$node_modules/zod/lib/ZodError").ZodInvalidUnionIssue & { fatal?: boolean | undefined; message: string; }' is not assignable to type 'Zod.ZodInvalidUnionIssue & { fatal?: boolean | undefined; message: string; }'.
                                Type 'ZodInvalidUnionIssue & { fatal?: boolean | undefined; message: string; }' is not assignable to type 'ZodInvalidUnionIssue'.
                                  Types of property 'unionErrors' are incompatible.
                                    Type 'import("file:///Users/repro/$node_modules/.deno/[email protected]/$node_modules/zod/lib/ZodError").ZodError<any>[]' is not assignable to type 'Zod.ZodError<any>[]'.
                                      Type 'import("file:///Users/repro/$node_modules/.deno/[email protected]/$node_modules/zod/lib/ZodError").ZodError<any>' is not assignable to type 'Zod.ZodError<any>'.
                                        Types of property 'addIssue' are incompatible.
                                          Type '(sub: import("file:///Users/repro/$node_modules/.deno/[email protected]/$node_modules/zod/lib/ZodError").ZodIssue) => void' is not assignable to type '(sub: Zod.ZodIssue) => void'.
                                            Types of parameters 'sub' and 'sub' are incompatible.
                                              Type 'Zod.ZodIssue' is not assignable to type 'import("file:///Users/repro/$node_modules/.deno/[email protected]/$node_modules/zod/lib/ZodError").ZodIssue'.
                                                Type 'ZodInvalidUnionIssue & { fatal?: boolean | undefined; message: string; }' is not assignable to type 'ZodIssue'.
                                                  Type 'Zod.ZodInvalidUnionIssue & { fatal?: boolean | undefined; message: string; }' is not assignable to type 'import("file:///Users/repro/$node_modules/.deno/[email protected]/$node_modules/zod/lib/ZodError").ZodInvalidUnionIssue & { fatal?: boolean | undefined; message: string; }'.
                                                    Type 'ZodInvalidUnionIssue & { fatal?: boolean | undefined; message: string; }' is not assignable to type 'ZodInvalidUnionIssue'.
                                                      Types of property 'unionErrors' are incompatible.
                                                        Type 'Zod.ZodError<any>[]' is not assignable to type 'import("file:///Users/repro/$node_modules/.deno/[email protected]/$node_modules/zod/lib/ZodError").ZodError<any>[]'.
                                                          Type 'Zod.ZodError<any>' is not assignable to type 'import("file:///Users/repro/$node_modules/.deno/[email protected]/$node_modules/zod/lib/ZodError").ZodError<any>'.
                                                            Types of property 'addIssue' are incompatible.
                                                              Type '(sub: Zod.ZodIssue) => void' is not assignable to type '(sub: import("file:///Users/repro/$node_modules/.deno/[email protected]/$node_modules/zod/lib/ZodError").ZodIssue) => void'.
                                                                Types of parameters 'sub' and 'sub' are incompatible.
                                                                  Type 'import("file:///Users/repro/$node_modules/.deno/[email protected]/$node_modules/zod/lib/ZodError").ZodIssue' is not assignable to type 'Zod.ZodIssue'.
                                                                    Type 'ZodInvalidArgumentsIssue & { fatal?: boolean | undefined; message: string; }' is not assignable to type 'ZodIssue'.
import { extendZodWithOpenApi } from "@asteasolutions/zod-to-openapi";
import { z } from "zod";

extendZodWithOpenApi(z);

Versions

Zod - 3.24.2
@asteasolutions/zod-to-openapi - 7.3.0

@AGalabov
Copy link
Collaborator

@itizarsa I am not sure that this is enough for the error to occur. The same code within a regular (node) project works. I see that use deno so it might be related. Can you share your your repro code base so that I can see if there is anything outstanding that we can easily fix

@itizarsa
Copy link
Author

@AGalabov It seems that one of the packages used a lower zod version which caused this issue. Thanks for your response.

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