File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -108,14 +108,16 @@ export function commaSeparatedToArray<T extends string[]>(str: string | string[]
108108}
109109
110110/**
111- * Preprocessor for boolean values that handles string "true "/"false " correctly.
111+ * Preprocessor for boolean values that handles string "false "/"0 " correctly.
112112 * Zod's coerce.boolean() treats any non-empty string as true, which is not what we want.
113113 */
114114export function parseBoolean ( val : unknown ) : unknown {
115115 if ( typeof val === "string" ) {
116116 const lower = val . toLowerCase ( ) . trim ( ) ;
117- if ( lower === "false" || lower === "0" ) return false ;
118- if ( lower === "true" || lower === "1" ) return true ;
117+ if ( lower === "false" || lower === "0" || lower === "" ) {
118+ return false ;
119+ }
120+ return true ;
119121 }
120122 if ( typeof val === "boolean" ) {
121123 return val ;
You can’t perform that action at this time.
0 commit comments