File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -79,13 +79,13 @@ export function generateType(schema: Schema, options?: Options): TypeNode {
79
79
}
80
80
81
81
let valids : TypeNode [ ] = Array . from ( ( schema as ExtendedSchema ) . _valids ?. _values ?? new Set ( ) ) . map ( ( value ) => {
82
- // unknown | null is redundant, so just drop the null
83
- if ( schema . type === "any" && value === null ) {
82
+ // unknown | null is redundant, so just drop the null unless this is the only allowed value
83
+ if ( schema . _flags . only !== true && schema . type === "any" && value === null ) {
84
84
return ;
85
85
}
86
86
87
87
// string | "" is redundant, so just drop the ""
88
- if ( schema . type === "string" && value === "" ) {
88
+ if ( schema . _flags . only !== true && schema . type === "string" && value === "" ) {
89
89
return ;
90
90
}
91
91
You can’t perform that action at this time.
0 commit comments