function objectOfValidatorWithInvalidFieldTracking<T, K>(valueValidator, keyValidator): (subject, invalidFields?, level) => subject is Record<K, T>
This validator functions the same as objectOfValidator, with the option of passing in a map
which will track all of the fields that were found to be invalid.
Type parameters
| Type parameter | Value |
|---|---|
T | - |
K extends string | number | symbol | string |
Parameters
| Parameter | Type | Description |
|---|---|---|
valueValidator | ValidatorWithTracking<T> | The validator to be used on the object fields |
keyValidator | ValidatorWithTracking<K> | Optional validator to be used on the object keys. If not provided, keys are not validated and asserted to be strings. |
Returns
Function
Parameters
| Parameter | Type | Default value |
|---|---|---|
subject | unknown | undefined |
invalidFields? | Map<number, unknown[]> | undefined |
level? | number | 0 |
Returns
subject is Record<K, T>