fix: strongly types field validation args (#8263)

Continuation of #8243. Strongly types the `value` argument within
`field.validate` functions:

- Uses existing internal validation types for field `validate` property
- Exports additional validation types to cover `hasMany` fields
- Includes `null` and `undefined` values
This commit is contained in:
Jacob Fletcher
2024-09-17 15:14:10 -04:00
committed by GitHub
parent 110fda7533
commit c0aad3cccb
4 changed files with 110 additions and 28 deletions

View File

@@ -60,7 +60,7 @@ const NumberFields: CollectionConfig = {
name: 'validatesHasMany',
type: 'number',
hasMany: true,
validate: (value: number[]) => {
validate: (value) => {
if (value && !Array.isArray(value)) {
return 'value should be an array'
}