Skip to content

Commit

Permalink
Merge pull request #2057 from trygveaa/add-documentation-for-z-custom…
Browse files Browse the repository at this point in the history
…-params

Add documentation for the param parameter of z.custom
  • Loading branch information
JacobWeisenburger committed Feb 19, 2023
2 parents 9b7dd81 + 5cec187 commit 654f529
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
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 654f529

Please sign in to comment.