Skip to content

.strict() mode to remove excess properties. Not throw an error? #74

Description

@InputNeuron

I have a situation where I need to write a Cat object via tRPC but the procedure only accepts a Pet.

(contrived example).

the Cat property has a "whiskers" param which Pet does not have so it throws an error when I'm trying to call tRPC.

This compiles just fine with Typescript but I get a runtime error when I try to write to the DB.

I think we should have a strict() version of wrap() where Zod will remove the excess properties.

This way it can write the Pet to the db without the whiskers param.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions