File tree 3 files changed +4
-11
lines changed
3 files changed +4
-11
lines changed Original file line number Diff line number Diff line change @@ -2556,8 +2556,8 @@ numberWithRandomDefault.parse(undefined); // => 0.7223408162401552
2556
2556
2557
2557
Conceptually, this is how Zod processes default values:
2558
2558
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).
2561
2561
2562
2562
### ` .describe `
2563
2563
Original file line number Diff line number Diff line change @@ -2556,8 +2556,8 @@ numberWithRandomDefault.parse(undefined); // => 0.7223408162401552
2556
2556
2557
2557
Conceptually, this is how Zod processes default values:
2558
2558
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).
2561
2561
2562
2562
### ` .describe `
2563
2563
Original file line number Diff line number Diff line change 1
1
import { z } from "./src" ;
2
2
3
3
z ;
4
-
5
- const Schema = z
6
- . object ( {
7
- limit : z . number ( ) . default ( 0 ) ,
8
- } )
9
- . default ( { } ) ;
10
- type Schema = z . infer < typeof Schema > ;
You can’t perform that action at this time.
0 commit comments