@@ -101,9 +101,8 @@ const defaultComponentMatchers: PydanticComponentMatcher[] = [
101101 // We are looking for a single value from a set list of options. With less than 4 options, use radio buttons.
102102 return (
103103 field . type === PydanticFormFieldType . STRING &&
104- field . options &&
105- field . options . length > 0 &&
106- field . options . length <= 3
104+ field . options ?. length > 0 &&
105+ field . options ?. length <= 3
107106 ) ;
108107 } ,
109108 } ,
@@ -117,8 +116,7 @@ const defaultComponentMatchers: PydanticComponentMatcher[] = [
117116 // We are looking for a single value from a set list of options. With more than 3 options, use a dropdown.
118117 return (
119118 field . type === PydanticFormFieldType . STRING &&
120- field . options &&
121- field . options . length >= 4
119+ field . options ?. length >= 4
122120 ) ;
123121 } ,
124122 } ,
@@ -141,9 +139,8 @@ const defaultComponentMatchers: PydanticComponentMatcher[] = [
141139 matcher ( field ) {
142140 return (
143141 field . type === PydanticFormFieldType . ARRAY &&
144- field . options &&
145- field . options . length > 0 &&
146- field . options . length <= 5
142+ field . options ?. length > 0 &&
143+ field . options ?. length <= 5
147144 ) ;
148145 } ,
149146 validator : zodValidationPresets . multiSelect ,
@@ -156,8 +153,7 @@ const defaultComponentMatchers: PydanticComponentMatcher[] = [
156153 } ,
157154 matcher ( field ) {
158155 return (
159- field . options &&
160- field . options . length > 0 &&
156+ field . options ?. length > 0 &&
161157 field . type === PydanticFormFieldType . ARRAY
162158 ) ;
163159 } ,
0 commit comments