Skip to content

Commit

Permalink
Add documentation for the param parameter of z.custom
Browse files Browse the repository at this point in the history
  • Loading branch information
trygveaa committed Feb 18, 2023
1 parent 9b7dd81 commit 5cec187
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1714,6 +1714,12 @@ If you don't provide a validation function, Zod will allow any value. This can b
z.custom<{ arg: string }>(); // performs no validation
```

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).

```ts
z.custom<...>((val) => ..., "custom error message");
```

## Schema methods

All Zod schemas contain certain methods.
Expand Down

0 comments on commit 5cec187

Please sign in to comment.