@@ -137,12 +137,14 @@ function formDataToValidation<T extends AnyZodObject>(
137137 typeInfo : ZodTypeInfo
138138 ) : unknown {
139139 const newValue = valueOrDefault ( value , false , true , typeInfo ) ;
140+ const zodType = typeInfo . zodType ;
140141
141142 // If the value was empty, it now contains the default value,
142- // so it can be returned immediately
143- if ( ! value ) return newValue ;
144-
145- const zodType = typeInfo . zodType ;
143+ // so it can be returned immediately, unless it's boolean, which
144+ // means it could have been posted as a checkbox.
145+ if ( ! value && zodType . _def . typeName != 'ZodBoolean' ) {
146+ return newValue ;
147+ }
146148
147149 if ( zodType . _def . typeName == 'ZodString' ) {
148150 return value ;
@@ -182,14 +184,14 @@ function formDataToValidation<T extends AnyZodObject>(
182184 return value ;
183185 } else if ( zodType . _def . typeName == 'ZodNativeEnum' ) {
184186 const zodEnum = zodType as ZodNativeEnum < EnumLike > ;
185- if ( value in zodEnum . enum ) {
187+ if ( value !== null && value in zodEnum . enum ) {
186188 const enumValue = zodEnum . enum [ value ] ;
187189 if ( typeof enumValue === 'number' ) return enumValue ;
188190 else if ( enumValue in zodEnum . enum ) return zodEnum . enum [ enumValue ] ;
189191 }
190192 return undefined ;
191193 } else if ( zodType . _def . typeName == 'ZodSymbol' ) {
192- return Symbol ( value ) ;
194+ return Symbol ( String ( value ) ) ;
193195 }
194196
195197 throw new SuperFormError (
0 commit comments