defineCollection
defineCollection<
TFieldMeta,TCollectionMeta,TCollectionSlug,TFields>(config):CollectionConfig<TFieldMeta,TCollectionMeta,TCollectionSlug,TFields>
Defined in: packages/react/src/index.ts:342
Defines a collection with React-typed component slots.
Drop-in replacement for @vexcms/core’s defineCollection — same
behaviour, but admin.components.preview is typed as a React
ComponentType<RelationshipPreviewProps<TCollectionSlug>>.
The parameter type is derived from core’s own signature rather than
restated, so core’s reserved-field-key guard (naming a field updatedAt is
a compile error) reaches callers of this wrapper too, and cannot drift from
it.
Type Parameters
Section titled “Type Parameters”TFieldMeta
Section titled “TFieldMeta”TFieldMeta extends object = { }
TCollectionMeta
Section titled “TCollectionMeta”TCollectionMeta extends object = { }
TCollectionSlug
Section titled “TCollectionSlug”TCollectionSlug extends string = string
TFields
Section titled “TFields”TFields extends Record<string, AdminField<TFieldMeta>> = Record<string, AdminField<TFieldMeta>>
Parameters
Section titled “Parameters”config
Section titled “config”string extends keyof TFields ? CollectionConfigInput<TFieldMeta, TCollectionMeta, TCollectionSlug, TFields, ReactHKT, false, true> : [keyof TFields & "vex_status" | "vex_publishedAt" | "vex_publishedId" | "vex_activeVersion" | "updatedAt"] extends [never] ? CollectionConfigInput<TFieldMeta, TCollectionMeta, TCollectionSlug, TFields, ReactHKT, false, true> : object
Collection configuration.
Returns
Section titled “Returns”CollectionConfig<TFieldMeta, TCollectionMeta, TCollectionSlug, TFields>
The resolved collection configuration.