Skip to content

Commit

Permalink
Replace nonempty() usage with min(1)
Browse files Browse the repository at this point in the history
Co-authored-by: Scott Trinh <scottyparade@gmail.com>
  • Loading branch information
gtarsia and scotttrinh committed May 25, 2022
1 parent 4235d8d commit 1b71f5c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1075,7 +1075,7 @@ If you want to validate both the keys and the values, use
`z.record(keyType, valueType)`:

```ts
const NoEmptyKeysSchema = z.record(z.string().nonempty(), z.number());
const NoEmptyKeysSchema = z.record(z.string().min(1), z.number());
NoEmptyKeysSchema.parse({ 'count': 1 }) // => { 'count': 1 }
NoEmptyKeysSchema.parse({ '': 1 }) // fails
```
Expand Down

0 comments on commit 1b71f5c

Please sign in to comment.