Mention parse options in the documentation
Opened this issue · 2 comments
Schema method .parse()
accepts an optional second argument params
.
type ParseParams = {
path: (string | number)[];
errorMap: ZodErrorMap;
async: boolean;
};
I've found it very useful, especially errorMap
property.
The usage is described in https://github.com/colinhacks/zod/blob/main/ERROR_HANDLING.md.
Unfortunately, in the .parse()
documentation the params
is not mentioned, see https://zod.dev/?id=parse
I think this just hide a very useful feature.
Would be nice to add params
to .parse()
documentation, or at least mention it and link ERROR_HANDLING.md
Hm yeah, it's definitely an oversight to not include errorMap
anywhere in the main README. I think I was hesitant to document error maps too visibly since they're a comparatively advanced feature and might feel intimidating to some users. I'll work on this.
The other two params aren't really intended for direct use and should probably be hidden from the public API.
Thanks, errorMap
is a super convenient feature.