Skip to content

variantValidator

variantValidator<TCollectionSlug>(slug, fn): FieldValidate<TCollectionSlug, unknown>

Defined in: packages/core/src/fields/variant/validator.ts:69

Types a variant() field’s validate() against a real collection and DataModel.

TCollectionSlug extends string

TCollectionSlug

The owning collection’s slug, used only to infer TCollectionSlug.

FieldValidate<TCollectionSlug, unknown, VariantField>

The validate callback, checked against the collection’s real document shape and value type.

FieldValidate<TCollectionSlug, unknown>

The same function, re-typed to the field’s loose public validate signature.

fieldValidator