zod icon indicating copy to clipboard operation
zod copied to clipboard

`CreateParams` get lost when calling any of the root-level methods

Open santosmarco-caribou opened this issue 2 years ago • 0 comments

const MySchema = z.string({ description: 'this is a string schema' }).optional()
// => No longer has the description associated with it

This is because we are not passing the CreateParams to these methods on the root-level ZodType class.

Instead of:

nullable() {
  ZodNullable.create(this);
}

We should find a way to pass the CreateParams as well.

nullable() {
  ZodNullable.create(this, /* => */ params);
}

santosmarco-caribou avatar Dec 22 '22 14:12 santosmarco-caribou