File tree Expand file tree Collapse file tree 1 file changed +6
-9
lines changed
Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -76,10 +76,7 @@ export const streamingExtractFinalValue = (
7676 if ( state . currField . type ?. name === 'json' ) {
7777 values [ state . currField . name ] = validateAndParseJson ( state . currField , val ) ;
7878 } else {
79- values [ state . currField . name ] = convertValueToType (
80- state . currField . type ?. name ?? 'string' ,
81- val
82- ) ;
79+ values [ state . currField . name ] = convertValueToType ( state . currField , val ) ;
8380 }
8481} ;
8582
@@ -105,11 +102,11 @@ const validateAndParseSingleValue = (
105102 }
106103} ;
107104
108- const convertValueToType = (
109- expectedType : string ,
110- val : unknown
111- ) : string | number | boolean | Date => {
112- switch ( expectedType ) {
105+ const convertValueToType = ( field : Readonly < AxField > , val : unknown ) => {
106+ if ( field . isOptional && ( ! val || val === '' ) ) {
107+ return ;
108+ }
109+ switch ( field . type ?. name ) {
113110 case 'string' :
114111 return val as string ;
115112 case 'number' :
You can’t perform that action at this time.
0 commit comments