Colin McDonnell

Results 258 comments of Colin McDonnell

This is on the roadmap. Though it'll likely be an object instead of a string to leave room for future API additions. ```ts z.string({ message: "That's not a string!" });...

I think hard-coding an error message should override the error map in this case. Based on my limited understanding of what you're trying to do, it sounds like an anti-pattern....

@osdiab you can globally modify every error Zod creates with Error Maps: https://github.com/colinhacks/zod/blob/master/ERROR_HANDLING.md#customizing-errors-with-zoderrormap

Zod is very unopinionated about this stuff. It gives you all the information it can and lets you use whatever mechanism you like for displaying those to the end user....

There's an argument that this should be a top-level `z.omit` utility, which has been suggested elsewhere. ```ts const a = z.nativeEnum( { a: 1, b: 2 } as const )...

> you're omitting by value? The inferred type of this this enum is `1 | 2` so you'd omit a literal `2` to remove that option. ```ts const a =...

@zomars approach would be the recommended way to do this ```ts const stringWithDefault = z.string().optional().transform((val) => val || "tuna") ```

Hi folks, interesting discussion here. I seems like adding a `label` property and passing it into error maps is an unnecessary layer of indirection. Same for `description`, which I only...

Yep, seems like an oversight, should be a quick addition. I'll look into it.