## Description
<ins>Problem</ins>
When we have a `select/multi-select` field type and the source data
gives empty array to the `JSONFormWidget`, the widget tries to gauge the
sub type for value inside the array, and since it is empty it got
`undefined`
This led to re-evaluation of property config for the field.
<ins>Solution</ins>
- Added a check to prevent unnecessary recalculation of sub data types
when arrays are empty in `checkIfArrayAndSubDataTypeChanged`.
- Changed parameter type from `any` to `unknown` in `dataTypeFor` and
`subDataTypeFor` functions for improved type safety.
- Added and refactored unit tests.
This refactor enhances type safety and optimizes performance in the
schema parsing logic.
Fixes#37246
_or_
Fixes `Issue URL`
> [!WARNING]
> _If no issue exists, please create an issue first, and check with the
maintainers if the issue is valid._
## Automation
/ok-to-test tags="@tag.JSONForm"
### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results -->
> [!TIP]
> 🟢🟢🟢 All cypress tests have passed! 🎉🎉🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/12905055896>
> Commit: cad7015881c16a9af273b84dcf44cc33e32fb7d9
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=12905055896&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.JSONForm`
> Spec:
> <hr>Wed, 22 Jan 2025 09:50:23 UTC
<!-- end of auto-generated comment: Cypress test results -->
## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [x] No
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **Tests**
- Enhanced test suite for determining field types.
- Added comprehensive test cases covering primitive values, email
formats, date formats, array types, object types, and edge cases.
- **Refactor**
- Updated type annotations in schema parser functions to improve type
safety.
- Changed parameter types from `any` to `unknown`.
- Added clarifying comment for handling empty arrays in type checking.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->