Skip to content

CollectionItemValidatorCallback

Andrei Fangli edited this page Oct 4, 2023 · 4 revisions
API / CollectionItemValidatorCallback<TValidatable, TItem> type

Represents a collection bound validator callback.

type CollectionItemValidatorCallback<TValidatable extends IReadOnlyValidatable, TItem> = (validatable: TValidatable, item: TItem, collection: readonly TItem[]) => string | undefined

Template Parameters

  • TValidatable: the type of validatable objects to validate. Must implement IReadOnlyValidatable.
  • TItem: the type of items the collection contains.

Parameters

  • validatable: TValidatable, the object being validated.
  • item: TItem, the item from which the validatable has been selected.
  • collection: readonly Array<TItem>, the collection to which the item belongs.

Returns: String or undefined

Returns an error message (or translation key) providing information as to why the validatable is invalid.

Clone this wiki locally