(fieldName_0: string, value: number | string | boolean | string[] | undefined)
| 326 | } |
| 327 | } |
| 328 | function setField(fieldName_0: string, value: number | string | boolean | string[] | undefined) { |
| 329 | setFormValues(prev => { |
| 330 | const next = { |
| 331 | ...prev |
| 332 | }; |
| 333 | if (value === undefined) { |
| 334 | delete next[fieldName_0]; |
| 335 | } else { |
| 336 | next[fieldName_0] = value; |
| 337 | } |
| 338 | return next; |
| 339 | }); |
| 340 | // Clear "required" error when a value is provided |
| 341 | if (value !== undefined && validationErrors[fieldName_0] === 'This field is required') { |
| 342 | updateValidationError(fieldName_0); |
| 343 | } |
| 344 | } |
| 345 | function updateValidationError(fieldName_1: string, error?: string) { |
| 346 | setValidationErrors(prev_0 => { |
| 347 | const next_0 = { |
no test coverage detected