emilwidlund / nodl

A framework for computational node graphs.
https://usenodl.dev
MIT License
1.64k stars 36 forks source link

Zod version mismatch (not a peer dependency?) #24

Closed PetrosiliusPatter closed 1 year ago

PetrosiliusPatter commented 1 year ago

I'm trying to define an schema for an input, but I'm getting the following error:

Argument of type 'ZodNumber' is not assignable to parameter of type 'ZodType<any, ZodTypeDef, any>'.
  The types of '_def.errorMap' are incompatible between these types.
    Type 'import("c:/Users/<redacted>/node_modules/zod/lib/ZodError").ZodErrorMap' is not assignable to type 'Zod.ZodErrorMap'.

This happens because nodl has zod version "^3.20.2" set as a dependency, and I'm using "^3.21.4" in my project. Not a big problem, I can go back to 3.20.2, but I think this can be fixed by defining zod as a peer dependency in nodl. (At least I'm pretty sure this is the problem & solution lol)

edit: I'm using yarn btw. And actually, even if I set my zod dependency to "^3.20.2", yarn of course installs 3.21.4. So I gotta be explicit there.

Do you know why yarn installs 3.20.2 as dependency for nodl, but 3.21.4 for my own dependency? Shouldn't it resolve those to the same version, if both say "^...."?

emilwidlund commented 1 year ago

That's weird. But I went ahead and bumped Zod to 3.21.4 now and added as peer dependency. Available as 1.0.3 in @nodl/core. See #26.