Skip to content

Commit 654f529

Browse files
Merge pull request #2057 from trygveaa/add-documentation-for-z-custom-params
Add documentation for the param parameter of z.custom
2 parents 9b7dd81 + 5cec187 commit 654f529

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Diff for: README.md

+6
Original file line numberDiff line numberDiff line change
@@ -1714,6 +1714,12 @@ If you don't provide a validation function, Zod will allow any value. This can b
17141714
z.custom<{ arg: string }>(); // performs no validation
17151715
```
17161716

1717+
You can customize the error message and other options by passing a second argument. This parameter works the same way as the params parameter of [`.refine`](#refine).
1718+
1719+
```ts
1720+
z.custom<...>((val) => ..., "custom error message");
1721+
```
1722+
17171723
## Schema methods
17181724

17191725
All Zod schemas contain certain methods.

0 commit comments

Comments
 (0)