Giter Club home page Giter Club logo

Comments (4)

maxmarchuk avatar maxmarchuk commented on September 27, 2024

I have a very similar issue with "zod": "^3.23.8". regardless of the types i'm using in my schema, it is generating each field as optional (even if i don't say .optional()).

from zod.

s0h1s2 avatar s0h1s2 commented on September 27, 2024

I have similar issue here too.

from zod.

matvejs16 avatar matvejs16 commented on September 27, 2024

Have excatly the same problem. Any solutions or ways how to avoid this?

from zod.

gregg-cbs avatar gregg-cbs commented on September 27, 2024

We are seeing this too. We have figured this out though. We are using a monorepo but the below should be useful to anyone.

If one of your fields in your schema has an issue all the fields will show as type "unknown". So strip your schemas down to one field that is simply 'z.string()' and see if that works, then build your schema back up to see where the issue is.

If you are using aliases to import files and you have configured your tsconfig.json like the below you will have an issue when importing your types into another project other projects do not know how to resolve those alias pathways.

{
  "compilerOptions": {
    "paths": {
      "address/*": ["src/packages/address/*"],
      "database/*": ["src/packages/database/*"],
      "link/*": ["src/packages/link/*"],
      "media/*": ["src/packages/media/*"],
      "notification/*": ["src/packages/notification/*"],
    },
  },
}

The fix we have done is to not use alias pathways for our schemas. Possibly there might be some config setting to fix how your other projects resolve alias pathways but I dont have time to figure that out.

from zod.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.