Skip to content

Commit 301e5ca

Browse files
committed
Tweak default docs
1 parent a21a012 commit 301e5ca

File tree

3 files changed

+4
-11
lines changed

3 files changed

+4
-11
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2556,8 +2556,8 @@ numberWithRandomDefault.parse(undefined); // => 0.7223408162401552
25562556

25572557
Conceptually, this is how Zod processes default values:
25582558

2559-
1. If the input is `undefined`, the default value is returned
2560-
2. Otherwise, the data is parsed using the base schema
2559+
1. If the input is `undefined`, the default value is substituted
2560+
2. Then the data is parsed using the base schema. Your default value will be parsed by the schema (including any potential transforms).
25612561

25622562
### `.describe`
25632563

deno/lib/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2556,8 +2556,8 @@ numberWithRandomDefault.parse(undefined); // => 0.7223408162401552
25562556

25572557
Conceptually, this is how Zod processes default values:
25582558

2559-
1. If the input is `undefined`, the default value is returned
2560-
2. Otherwise, the data is parsed using the base schema
2559+
1. If the input is `undefined`, the default value is substituted
2560+
2. Then the data is parsed using the base schema. Your default value will be parsed by the schema (including any potential transforms).
25612561

25622562
### `.describe`
25632563

playground.ts

-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
11
import { z } from "./src";
22

33
z;
4-
5-
const Schema = z
6-
.object({
7-
limit: z.number().default(0),
8-
})
9-
.default({});
10-
type Schema = z.infer<typeof Schema>;

0 commit comments

Comments
 (0)